<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: /HElib/include/helib/permutations.h Source File</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d0c4ae63660968bf6b1c77a1e8aecf95.html">helib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">permutations.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="permutations_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* Copyright (C) 2012-2020 IBM Corp.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * This program is Licensed under the Apache License, Version 2.0</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * (the &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * with the License. You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *   http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * limitations under the License. See accompanying LICENSE file.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#ifndef HELIB_PERMUTATIONS_H</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#define HELIB_PERMUTATIONS_H</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160; </div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_p_algebra_8h.html">helib/PAlgebra.h</a>&gt;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="matching_8h.html">helib/matching.h</a>&gt;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="hypercube_8h.html">helib/hypercube.h</a>&gt;</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="api_attributes_8h.html">helib/apiAttributes.h</a>&gt;</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160; </div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacehelib.html">helib</a> {</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160; </div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">   27</a></span>&#160;<span class="keyword">typedef</span> NTL::Vec&lt;long&gt; <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>;</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160; </div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a0cf8627539f6c1c46e6ae9287058f7cc">applyPermToVec</a>(NTL::Vec&lt;T&gt;&amp; out, <span class="keyword">const</span> NTL::Vec&lt;T&gt;&amp; in, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; p1);</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a0cf8627539f6c1c46e6ae9287058f7cc">applyPermToVec</a>(std::vector&lt;T&gt;&amp; out,</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;                    <span class="keyword">const</span> std::vector&lt;T&gt;&amp; in,</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;                    <span class="keyword">const</span> <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; p1);</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160; </div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a0ae17bbc28a578112d0fe28b99f5e204">applyPermsToVec</a>(NTL::Vec&lt;T&gt;&amp; out,</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;                     <span class="keyword">const</span> NTL::Vec&lt;T&gt;&amp; in,</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;                     <span class="keyword">const</span> <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; p2,</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;                     <span class="keyword">const</span> <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; p1);</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a0ae17bbc28a578112d0fe28b99f5e204">applyPermsToVec</a>(std::vector&lt;T&gt;&amp; out,</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;                     <span class="keyword">const</span> std::vector&lt;T&gt;&amp; in,</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;                     <span class="keyword">const</span> <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; p2,</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;                     <span class="keyword">const</span> <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; p1);</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160; </div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#aa74c29f86e466570325f829fe4ea74b0">randomPerm</a>(<a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; perm, <span class="keywordtype">long</span> n);</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160; </div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="line" href="classhelib_1_1_col_perm.html">   90</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_col_perm.html">ColPerm</a> : <span class="keyword">public</span> <a class="code" href="classhelib_1_1_hyper_cube.html">HyperCube</a>&lt;long&gt;</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;{</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;  <span class="keywordtype">long</span> dim;</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;  <a class="code" href="classhelib_1_1_col_perm.html">ColPerm</a>(); <span class="comment">// disabled</span></div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160; </div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="classhelib_1_1_col_perm.html#a32e6af8568f7b694f7cf8ac741068876">   97</a></span>&#160;  <span class="keyword">explicit</span> <a class="code" href="classhelib_1_1_col_perm.html#a32e6af8568f7b694f7cf8ac741068876">ColPerm</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_cube_signature.html">CubeSignature</a>&amp; _sig) : <a class="code" href="classhelib_1_1_hyper_cube.html">HyperCube</a>&lt;long&gt;(_sig)</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;  {</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    dim = -1;</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;  }</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160; </div>
<div class="line"><a name="l00102"></a><span class="lineno"><a class="line" href="classhelib_1_1_col_perm.html#ad8e99bbc0c87074fb6e0573a6a4f0d7e">  102</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_col_perm.html#ad8e99bbc0c87074fb6e0573a6a4f0d7e">getPermDim</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> dim; }</div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="line" href="classhelib_1_1_col_perm.html#a59bc214fc506be70044fcc9b3784b578">  103</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_col_perm.html#a59bc214fc506be70044fcc9b3784b578">setPermDim</a>(<span class="keywordtype">long</span> _dim)</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;  {</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <a class="code" href="namespacehelib.html#a8e36344202aac3b245f5ba71f69a3e8b">assertInRange</a>(_dim,</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;                  0l,</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;                  <a class="code" href="classhelib_1_1_hyper_cube.html#a0f68841b322376a580348abfb7ab0274">getNumDims</a>(),</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;                  <span class="stringliteral">&quot;Algebra does not have a dimension of index _dim: &quot;</span> +</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;                      std::to_string(_dim));</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    dim = _dim;</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;  }</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160; </div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_col_perm.html#ab411c50c5ac089fb1902e27ccddea97b">makeExplicit</a>(<a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; out) <span class="keyword">const</span>; <span class="comment">// Write the permutation explicitly</span></div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160; </div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_col_perm.html#a654d1378767cfeb58d987a62464e682b">getShiftAmounts</a>(<a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; out) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160; </div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_col_perm.html#ab93293184a7cf1d97b6fc71c5df5e02d">getBenesShiftAmounts</a>(NTL::Vec&lt;Permut&gt;&amp; out,</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;                            NTL::Vec&lt;bool&gt;&amp; idID,</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;                            <span class="keyword">const</span> NTL::Vec&lt;long&gt;&amp; benesLvls) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160; </div>
<div class="line"><a name="l00128"></a><span class="lineno"><a class="line" href="classhelib_1_1_col_perm.html#afcb79f8c47fe29afc159d3471c270263">  128</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_col_perm.html#afcb79f8c47fe29afc159d3471c270263">printout</a>(std::ostream&amp; s)</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;  { <span class="comment">// a test/debugging method</span></div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    s &lt;&lt; <span class="stringliteral">&quot;Cube signature: &quot;</span> &lt;&lt; <a class="code" href="classhelib_1_1_hyper_cube.html#a4a1d07c48de62dc384f9059c1dbd0625">getSig</a>() &lt;&lt; std::endl;</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    s &lt;&lt; <span class="stringliteral">&quot;  dim=&quot;</span> &lt;&lt; dim &lt;&lt; std::endl;</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;    s &lt;&lt; <span class="stringliteral">&quot;  data=&quot;</span> &lt;&lt; <a class="code" href="classhelib_1_1_hyper_cube.html#aec3fa326e745e6909d1e2c554bf63747">getData</a>() &lt;&lt; std::endl;</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;  }</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;};</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;std::ostream&amp; <a class="code" href="namespacehelib.html#addc58993c7093dd07d98335bab200e82">operator&lt;&lt;</a>(std::ostream&amp; s, <span class="keyword">const</span> ColPerm&amp; p);</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160; </div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a11554e25622d14682edfa2be22ed6df6">breakPermByDim</a>(std::vector&lt;ColPerm&gt;&amp; out,</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;                    <span class="keyword">const</span> <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; pi,</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;                    <span class="keyword">const</span> CubeSignature&amp; sig);</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160; </div>
<div class="line"><a name="l00151"></a><span class="lineno"><a class="line" href="classhelib_1_1_general_benes_network.html">  151</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_general_benes_network.html">GeneralBenesNetwork</a></div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;{</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;  <span class="keywordtype">long</span> n; <span class="comment">// size of perm, n &gt; 1, not necessarily power of 2</span></div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;  <span class="keywordtype">long</span> k; <span class="comment">// recursion depth, k = least integer k s/t 2^k &gt;= n</span></div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160; </div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;  NTL::Vec&lt;NTL::Vec&lt;short&gt;&gt; level;</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;  <span class="comment">// there are 2*k - 1 levels, each with n nodes.</span></div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;  <span class="comment">// level[i][j] is 0, 1, or -1,</span></div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;  <span class="comment">//   which designates an edge from node j at level i</span></div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;  <span class="comment">//   to node j + level[i][j]*shamt(i) at level i+1</span></div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160; </div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;  <a class="code" href="classhelib_1_1_general_benes_network.html">GeneralBenesNetwork</a>(); <span class="comment">// default constructor disabled</span></div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160; </div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00168"></a><span class="lineno"><a class="line" href="classhelib_1_1_general_benes_network.html#ae86d8873a231c2834359507781f6dfc3">  168</a></span>&#160;  <span class="keyword">static</span> <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_general_benes_network.html#ae86d8873a231c2834359507781f6dfc3">depth</a>(<span class="keywordtype">long</span> n)</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;  {</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;    <span class="keywordtype">long</span> k = 1;</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;    <span class="keywordflow">while</span> ((1L &lt;&lt; k) &lt; n)</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;      k++;</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;    <span class="keywordflow">return</span> k;</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;  }</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160; </div>
<div class="line"><a name="l00178"></a><span class="lineno"><a class="line" href="classhelib_1_1_general_benes_network.html#ad12ab0c6ab25a9576d4f52102036d2ec">  178</a></span>&#160;  <span class="keyword">static</span> <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_general_benes_network.html#ad12ab0c6ab25a9576d4f52102036d2ec">levelToDepthMap</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keywordtype">long</span> n, <span class="keywordtype">long</span> k, <span class="keywordtype">long</span> i)</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;  {</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;    assertInRange&lt;InvalidArgument&gt;(i,</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;                                   0l,</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;                                   2 * k - 1,</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;                                   <span class="stringliteral">&quot;Level number i not in [0, 2 * k - 1)&quot;</span>);</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;    <span class="keywordflow">return</span> (k - 1) - labs((k - 1) - i);</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;  }</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160; </div>
<div class="line"><a name="l00189"></a><span class="lineno"><a class="line" href="classhelib_1_1_general_benes_network.html#a7743131bdd9828324785b1d1ab329c2e">  189</a></span>&#160;  <span class="keyword">static</span> <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_general_benes_network.html#a7743131bdd9828324785b1d1ab329c2e">shamt</a>(<span class="keywordtype">long</span> n, <span class="keywordtype">long</span> k, <span class="keywordtype">long</span> i)</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;  {</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    <span class="keywordtype">long</span> d = <a class="code" href="classhelib_1_1_general_benes_network.html#ad12ab0c6ab25a9576d4f52102036d2ec">levelToDepthMap</a>(n, k, i);</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    <span class="keywordflow">return</span> ((n &gt;&gt; d) + 1) &gt;&gt; 1;</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;  }</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160; </div>
<div class="line"><a name="l00195"></a><span class="lineno"><a class="line" href="classhelib_1_1_general_benes_network.html#a52650b15e6be5b81c21c810a3317435f">  195</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_general_benes_network.html#a52650b15e6be5b81c21c810a3317435f">getDepth</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> k; }</div>
<div class="line"><a name="l00196"></a><span class="lineno"><a class="line" href="classhelib_1_1_general_benes_network.html#ae53c9f8e60c303de64a106e84069d17c">  196</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_general_benes_network.html#ae53c9f8e60c303de64a106e84069d17c">getSize</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> n; }</div>
<div class="line"><a name="l00197"></a><span class="lineno"><a class="line" href="classhelib_1_1_general_benes_network.html#a9e9329ff90053d6c4fab07b0a32fa509">  197</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_general_benes_network.html#a9e9329ff90053d6c4fab07b0a32fa509">getNumLevels</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> 2 * k - 1; }</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160; </div>
<div class="line"><a name="l00199"></a><span class="lineno"><a class="line" href="classhelib_1_1_general_benes_network.html#a8ab3837bf4ffb077d12aaea5e923993b">  199</a></span>&#160;  <span class="keyword">const</span> NTL::Vec&lt;short&gt;&amp; <a class="code" href="classhelib_1_1_general_benes_network.html#a8ab3837bf4ffb077d12aaea5e923993b">getLevel</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const</span></div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;    assertInRange&lt;InvalidArgument&gt;(i,</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;                                   0l,</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;                                   2 * k - 1,</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;                                   <span class="stringliteral">&quot;Level number i not in [0, 2 * k - 1)&quot;</span>);</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;    <span class="keywordflow">return</span> level[i];</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;  }</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160; </div>
<div class="line"><a name="l00208"></a><span class="lineno"><a class="line" href="classhelib_1_1_general_benes_network.html#aaa72d3cd338814502f87796a68f95925">  208</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_general_benes_network.html#aaa72d3cd338814502f87796a68f95925">levelToDepthMap</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1_general_benes_network.html#aaa72d3cd338814502f87796a68f95925">levelToDepthMap</a>(n, k, i); }</div>
<div class="line"><a name="l00209"></a><span class="lineno"><a class="line" href="classhelib_1_1_general_benes_network.html#aa3221b4f153e00ed2b3659111a698fc8">  209</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_general_benes_network.html#aa3221b4f153e00ed2b3659111a698fc8">shamt</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1_general_benes_network.html#aa3221b4f153e00ed2b3659111a698fc8">shamt</a>(n, k, i); }</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160; </div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;  <span class="comment">// constructor</span></div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;  <a class="code" href="classhelib_1_1_general_benes_network.html">GeneralBenesNetwork</a>(<span class="keyword">const</span> <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; perm);</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160; </div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;  <span class="comment">// test correctness</span></div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160; </div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_general_benes_network.html#ae0d074af92f13a6e09424f07348e08cd">testNetwork</a>(<span class="keyword">const</span> <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; perm) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;};</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160; </div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00225"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html">  225</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_full_binary_tree.html">FullBinaryTree</a>;</div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160; </div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00232"></a><span class="lineno"><a class="line" href="classhelib_1_1_tree_node.html">  232</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_tree_node.html">TreeNode</a></div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;{</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;  T data;</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;  <span class="keywordtype">long</span> parent;</div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;  <span class="keywordtype">long</span> leftChild, rightChild;</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;  <span class="keywordtype">long</span> prev, next; <span class="comment">// useful, e.g., to connect all leaves in a list</span></div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160; </div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;  <span class="keywordtype">void</span> makeNullIndexes() { parent = leftChild = rightChild = prev = next = -1; }</div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160; </div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00242"></a><span class="lineno"><a class="line" href="classhelib_1_1_tree_node.html#a4e2b6a600741294bd01d9904aa8fbf5a">  242</a></span>&#160;  <a class="code" href="classhelib_1_1_tree_node.html#a4e2b6a600741294bd01d9904aa8fbf5a">TreeNode</a>() { makeNullIndexes(); }</div>
<div class="line"><a name="l00243"></a><span class="lineno"><a class="line" href="classhelib_1_1_tree_node.html#a699a8dbe1934d152aa3804f8df118264">  243</a></span>&#160;  <span class="keyword">explicit</span> <a class="code" href="classhelib_1_1_tree_node.html#a699a8dbe1934d152aa3804f8df118264">TreeNode</a>(<span class="keyword">const</span> T&amp; d) : data(d) { makeNullIndexes(); }</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160; </div>
<div class="line"><a name="l00245"></a><span class="lineno"><a class="line" href="classhelib_1_1_tree_node.html#a9ca400783600593ead99700865257ca1">  245</a></span>&#160;  T&amp; <a class="code" href="classhelib_1_1_tree_node.html#a9ca400783600593ead99700865257ca1">getData</a>() { <span class="keywordflow">return</span> data; }</div>
<div class="line"><a name="l00246"></a><span class="lineno"><a class="line" href="classhelib_1_1_tree_node.html#a284ec567171c8b62b23dd350f4e820a4">  246</a></span>&#160;  <span class="keyword">const</span> T&amp; <a class="code" href="classhelib_1_1_tree_node.html#a284ec567171c8b62b23dd350f4e820a4">getData</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data; }</div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160; </div>
<div class="line"><a name="l00248"></a><span class="lineno"><a class="line" href="classhelib_1_1_tree_node.html#aba2c5e9f1bc8ec08cd5f1acd9265b94b">  248</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_tree_node.html#aba2c5e9f1bc8ec08cd5f1acd9265b94b">getParent</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> parent; }</div>
<div class="line"><a name="l00249"></a><span class="lineno"><a class="line" href="classhelib_1_1_tree_node.html#adda304eddb64acf8154c2bb3ab886b90">  249</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_tree_node.html#adda304eddb64acf8154c2bb3ab886b90">getLeftChild</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> leftChild; }</div>
<div class="line"><a name="l00250"></a><span class="lineno"><a class="line" href="classhelib_1_1_tree_node.html#aeba5112cf6532e25198e67054a7fdbdc">  250</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_tree_node.html#aeba5112cf6532e25198e67054a7fdbdc">getRightChild</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> rightChild; }</div>
<div class="line"><a name="l00251"></a><span class="lineno"><a class="line" href="classhelib_1_1_tree_node.html#a76d17b68beac47df9eebe534f3b285d6">  251</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_tree_node.html#a76d17b68beac47df9eebe534f3b285d6">getPrev</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> prev; }</div>
<div class="line"><a name="l00252"></a><span class="lineno"><a class="line" href="classhelib_1_1_tree_node.html#a60b1342707e9f8113a951c0459c32419">  252</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_tree_node.html#a60b1342707e9f8113a951c0459c32419">getNext</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> next; }</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160; </div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;  <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classhelib_1_1_full_binary_tree.html">FullBinaryTree</a>&lt;T&gt;;</div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;};</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160; </div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;<span class="comment">// A binary tree, the root is always the node at index 0</span></div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;<span class="keyword">class </span>FullBinaryTree</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;{</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;  <span class="keywordtype">long</span> aux; <span class="comment">// a &quot;foreign key&quot; for this tree (holds generator index)</span></div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;  std::vector&lt;TreeNode&lt;T&gt;&gt; nodes;</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;  <span class="keywordtype">long</span> nLeaves;           <span class="comment">// how many leaves in this tree</span></div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;  <span class="keywordtype">long</span> frstLeaf, lstLeaf; <span class="comment">// index of the first/last leaves</span></div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160; </div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00267"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a7d09c4eed35595ba4918da09c5e47670">  267</a></span>&#160;  <a class="code" href="classhelib_1_1_full_binary_tree.html#a7d09c4eed35595ba4918da09c5e47670">FullBinaryTree</a>(<span class="keywordtype">long</span> _aux = 0)</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;  {</div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;    aux = _aux;</div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;    nLeaves = 0;</div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;    frstLeaf = lstLeaf = -1;</div>
<div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;  } <span class="comment">// empty tree</span></div>
<div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160; </div>
<div class="line"><a name="l00274"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a97d8dc03b8e04481195b2201239ccf67">  274</a></span>&#160;  <span class="keyword">explicit</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#a97d8dc03b8e04481195b2201239ccf67">FullBinaryTree</a>(<span class="keyword">const</span> T&amp; d, <span class="keywordtype">long</span> _aux = 0) <span class="comment">// tree with only a root</span></div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;  {</div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;    aux = _aux;</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;    nLeaves = 1;</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;    <a class="code" href="classhelib_1_1_tree_node.html">TreeNode&lt;T&gt;</a> n(d);</div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;    nodes.push_back(n);</div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;    frstLeaf = lstLeaf = 0;</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;  }</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160; </div>
<div class="line"><a name="l00283"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a0eff022e81edd65c23a19e745cdea1a8">  283</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#a0eff022e81edd65c23a19e745cdea1a8">putDataInRoot</a>(<span class="keyword">const</span> T&amp; d)</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;  {</div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;    <span class="keywordflow">if</span> (nodes.size() == 0) { <span class="comment">// make new root</span></div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;      <a class="code" href="classhelib_1_1_tree_node.html">TreeNode&lt;T&gt;</a> n(d);</div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;      nodes.push_back(n);</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;      frstLeaf = lstLeaf = 0;</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;      nLeaves = 1;</div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;    } <span class="keywordflow">else</span></div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;      nodes[0].data = d; <span class="comment">// Root exists, just update data</span></div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;  }</div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160; </div>
<div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;  <span class="comment">// Provide some of the interfaces of the underlying std::vector</span></div>
<div class="line"><a name="l00295"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a2322753e1a3b66a4c8311a94cd0b4f8a">  295</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#a2322753e1a3b66a4c8311a94cd0b4f8a">size</a>() { <span class="keywordflow">return</span> (<span class="keywordtype">long</span>)nodes.size(); }</div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160; </div>
<div class="line"><a name="l00297"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a47298692347d43b21db61cad2bb9e859">  297</a></span>&#160;  <a class="code" href="classhelib_1_1_tree_node.html">TreeNode&lt;T&gt;</a>&amp; <a class="code" href="classhelib_1_1_full_binary_tree.html#a47298692347d43b21db61cad2bb9e859">operator[]</a>(<span class="keywordtype">long</span> i) { <span class="keywordflow">return</span> nodes[i]; }</div>
<div class="line"><a name="l00298"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#afb44279bb6acdf1d915345b4138655d7">  298</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_tree_node.html">TreeNode&lt;T&gt;</a>&amp; <a class="code" href="classhelib_1_1_full_binary_tree.html#afb44279bb6acdf1d915345b4138655d7">operator[]</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> nodes[i]; }</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160; </div>
<div class="line"><a name="l00300"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#ae547d2343a76c7aea8cc861ef571b4d4">  300</a></span>&#160;  <a class="code" href="classhelib_1_1_tree_node.html">TreeNode&lt;T&gt;</a>&amp; <a class="code" href="classhelib_1_1_full_binary_tree.html#ae547d2343a76c7aea8cc861ef571b4d4">at</a>(<span class="keywordtype">long</span> i) { <span class="keywordflow">return</span> nodes.at(i); }</div>
<div class="line"><a name="l00301"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a35b6be44ab7a1d5664c6e8f012d5f58a">  301</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_tree_node.html">TreeNode&lt;T&gt;</a>&amp; <a class="code" href="classhelib_1_1_full_binary_tree.html#a35b6be44ab7a1d5664c6e8f012d5f58a">at</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> nodes.at(i); }</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160; </div>
<div class="line"><a name="l00303"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a27f96d10780585b551451e95d33565a2">  303</a></span>&#160;  T&amp; <a class="code" href="classhelib_1_1_full_binary_tree.html#a27f96d10780585b551451e95d33565a2">DataOfNode</a>(<span class="keywordtype">long</span> i) { <span class="keywordflow">return</span> nodes.at(i).data; }</div>
<div class="line"><a name="l00304"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a7a4517a28a0c190db906951397868f84">  304</a></span>&#160;  <span class="keyword">const</span> T&amp; <a class="code" href="classhelib_1_1_full_binary_tree.html#a7a4517a28a0c190db906951397868f84">DataOfNode</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> nodes.at(i).data; }</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160; </div>
<div class="line"><a name="l00306"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a6342b220b460dd812fb76e47ff58d089">  306</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#a6342b220b460dd812fb76e47ff58d089">getAuxKey</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> aux; }</div>
<div class="line"><a name="l00307"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a7a67cd22f751036ddb171304de250d56">  307</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#a7a67cd22f751036ddb171304de250d56">setAuxKey</a>(<span class="keywordtype">long</span> _aux) { aux = _aux; }</div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160; </div>
<div class="line"><a name="l00309"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#ad2a5c0e3e0c0b66aacd2629503853575">  309</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#ad2a5c0e3e0c0b66aacd2629503853575">getNleaves</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> nLeaves; }</div>
<div class="line"><a name="l00310"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a149080a92be86e4e42fb2b92ee1bb355">  310</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#a149080a92be86e4e42fb2b92ee1bb355">firstLeaf</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> frstLeaf; }</div>
<div class="line"><a name="l00311"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a39250dec026d0e547d2d06411c0c3766">  311</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#a39250dec026d0e547d2d06411c0c3766">nextLeaf</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> nodes.at(i).next; }</div>
<div class="line"><a name="l00312"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a5a9c2de5be1d65990e89672b945425c9">  312</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#a5a9c2de5be1d65990e89672b945425c9">prevLeaf</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> nodes.at(i).prev; }</div>
<div class="line"><a name="l00313"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#aa00e0d8854a43a98607c68e79605dde6">  313</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#aa00e0d8854a43a98607c68e79605dde6">lastLeaf</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lstLeaf; }</div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160; </div>
<div class="line"><a name="l00315"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a01798e019b8ce5bf570b834478b73e7d">  315</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#a01798e019b8ce5bf570b834478b73e7d">rootIdx</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> 0; }</div>
<div class="line"><a name="l00316"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a1b0c2cd16833ff1cf0a8aae2546c41ae">  316</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#a1b0c2cd16833ff1cf0a8aae2546c41ae">parentIdx</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> nodes.at(i).parent; }</div>
<div class="line"><a name="l00317"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#aeb54f77e3a0471e40d7a5f6244a02c85">  317</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#aeb54f77e3a0471e40d7a5f6244a02c85">leftChildIdx</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> nodes.at(i).leftChild; }</div>
<div class="line"><a name="l00318"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a188e0896cc5316b9cc5a6bcb6a737fc0">  318</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#a188e0896cc5316b9cc5a6bcb6a737fc0">rightChildIdx</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> nodes.at(i).rightChild; }</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160; </div>
<div class="line"><a name="l00320"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#ad0b111242279dc9fea42852485b627b4">  320</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#ad0b111242279dc9fea42852485b627b4">printout</a>(std::ostream&amp; s, <span class="keywordtype">long</span> idx = 0)<span class="keyword"> const</span></div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;<span class="keyword">  </span>{</div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;    s &lt;&lt; <span class="stringliteral">&quot;[&quot;</span> &lt;&lt; aux &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;    s &lt;&lt; nodes[idx].getData();</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;    <span class="keywordflow">if</span> (<a class="code" href="classhelib_1_1_full_binary_tree.html#aeb54f77e3a0471e40d7a5f6244a02c85">leftChildIdx</a>(idx) &gt;= 0)</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;      <a class="code" href="classhelib_1_1_full_binary_tree.html#ad0b111242279dc9fea42852485b627b4">printout</a>(s, <a class="code" href="classhelib_1_1_full_binary_tree.html#aeb54f77e3a0471e40d7a5f6244a02c85">leftChildIdx</a>(idx));</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;    <span class="keywordflow">if</span> (<a class="code" href="classhelib_1_1_full_binary_tree.html#a188e0896cc5316b9cc5a6bcb6a737fc0">rightChildIdx</a>(idx) &gt;= 0)</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;      <a class="code" href="classhelib_1_1_full_binary_tree.html#ad0b111242279dc9fea42852485b627b4">printout</a>(s, <a class="code" href="classhelib_1_1_full_binary_tree.html#a188e0896cc5316b9cc5a6bcb6a737fc0">rightChildIdx</a>(idx));</div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;    s &lt;&lt; <span class="stringliteral">&quot;] &quot;</span>;</div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;  }</div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;  <span class="comment">//  friend std::istream&amp; operator&gt;&gt; (std::istream &amp;s, DoubleCRT &amp;d);</span></div>
<div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160; </div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#aa3069b26a92fbad0ecd6d3c4619311e6">addChildren</a>(<span class="keywordtype">long</span> prntIdx, <span class="keyword">const</span> T&amp; leftData, <span class="keyword">const</span> T&amp; rightData);</div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160; </div>
<div class="line"><a name="l00339"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#a3865814c12a478cf58958ff8b9cdec77">  339</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#a3865814c12a478cf58958ff8b9cdec77">collapseToRoot</a>()</div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;  {</div>
<div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160;    <span class="keywordflow">if</span> (nodes.size() &gt; 1) {</div>
<div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;      nodes.resize(1);</div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;      frstLeaf = lstLeaf = 0;</div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;      nLeaves = 1;</div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;    }</div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;  }</div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;};</div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00349"></a><span class="lineno"><a class="line" href="classhelib_1_1_full_binary_tree.html#aa3069b26a92fbad0ecd6d3c4619311e6">  349</a></span>&#160;<span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_full_binary_tree.html#aa3069b26a92fbad0ecd6d3c4619311e6">FullBinaryTree&lt;T&gt;::addChildren</a>(<span class="keywordtype">long</span> prntIdx,</div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;                                    <span class="keyword">const</span> T&amp; leftData,</div>
<div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;                                    <span class="keyword">const</span> T&amp; rightData)</div>
<div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;{</div>
<div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;  <a class="code" href="namespacehelib.html#a8e36344202aac3b245f5ba71f69a3e8b">assertInRange</a>(prntIdx, 0l, (<span class="keywordtype">long</span>)nodes.size(), <span class="stringliteral">&quot;Parent node does not exist&quot;</span>);</div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160; </div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;  <span class="comment">// If parent is a leaf, add to it two children</span></div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;  <span class="keywordflow">if</span> (nodes[prntIdx].leftChild == -1 &amp;&amp; nodes[prntIdx].rightChild == -1) {</div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;    <span class="keywordtype">long</span> childIdx = nodes.size();</div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;    <a class="code" href="classhelib_1_1_tree_node.html">TreeNode&lt;T&gt;</a> n1(leftData);</div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;    nodes.push_back(n1); <span class="comment">// add left child to std::vector</span></div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;    <a class="code" href="classhelib_1_1_tree_node.html">TreeNode&lt;T&gt;</a> n2(rightData);</div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;    nodes.push_back(n2); <span class="comment">// add right child to std::vector</span></div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160; </div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;    <a class="code" href="classhelib_1_1_tree_node.html">TreeNode&lt;T&gt;</a>&amp; parent = nodes[prntIdx];</div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;    <a class="code" href="classhelib_1_1_tree_node.html">TreeNode&lt;T&gt;</a>&amp; left = nodes[childIdx];</div>
<div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;    <a class="code" href="classhelib_1_1_tree_node.html">TreeNode&lt;T&gt;</a>&amp; right = nodes[childIdx + 1];</div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160; </div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;    parent.leftChild = childIdx; <span class="comment">// point to children from parent</span></div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;    parent.rightChild = childIdx + 1;</div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;    left.parent = right.parent = prntIdx; <span class="comment">// point to parent from children</span></div>
<div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160; </div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;    <span class="comment">// remove parent and insert children to the linked list of leaves</span></div>
<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;    left.prev = parent.prev;</div>
<div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160;    left.next = childIdx + 1;</div>
<div class="line"><a name="l00374"></a><span class="lineno">  374</span>&#160;    right.prev = childIdx;</div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;    right.next = parent.next;</div>
<div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;    <span class="keywordflow">if</span> (parent.prev &gt;= 0) { <span class="comment">// parent was not the 1st leaf</span></div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;      nodes[parent.prev].next = childIdx;</div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;      parent.prev = -1;</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;    } <span class="keywordflow">else</span> <span class="comment">// parent was the first leaf, now its left child is 1st</span></div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;      frstLeaf = childIdx;</div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160; </div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;    <span class="keywordflow">if</span> (parent.next &gt;= 0) { <span class="comment">// parent was not the last leaf</span></div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;      nodes[parent.next].prev = childIdx + 1;</div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;      parent.next = -1;</div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;    } <span class="keywordflow">else</span> <span class="comment">// parent was the last leaf, now its left child is last</span></div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;      lstLeaf = childIdx + 1;</div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160; </div>
<div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160;    nLeaves++; <span class="comment">// we replaced a leaf by a parent w/ two leaves</span></div>
<div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;  } <span class="keywordflow">else</span> {     <span class="comment">// parent is not a leaf, update the two children</span></div>
<div class="line"><a name="l00390"></a><span class="lineno">  390</span>&#160;    <a class="code" href="classhelib_1_1_tree_node.html">TreeNode&lt;T&gt;</a>&amp; parent = nodes[prntIdx];</div>
<div class="line"><a name="l00391"></a><span class="lineno">  391</span>&#160;    <a class="code" href="namespacehelib.html#aca37b5e05bffd4550c995e83594d7325">assertTrue</a>(parent.leftChild &gt;= 0, <span class="stringliteral">&quot;Left child does not exist&quot;</span>);</div>
<div class="line"><a name="l00392"></a><span class="lineno">  392</span>&#160;    <a class="code" href="namespacehelib.html#aca37b5e05bffd4550c995e83594d7325">assertTrue</a>(parent.rightChild &gt;= 0, <span class="stringliteral">&quot;Right child does not exist&quot;</span>);</div>
<div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160; </div>
<div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;    <a class="code" href="classhelib_1_1_tree_node.html">TreeNode&lt;T&gt;</a>&amp; left = nodes[parent.leftChild];</div>
<div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160;    <a class="code" href="classhelib_1_1_tree_node.html">TreeNode&lt;T&gt;</a>&amp; right = nodes[parent.rightChild];</div>
<div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160;    left.data = leftData;</div>
<div class="line"><a name="l00397"></a><span class="lineno">  397</span>&#160;    right.data = rightData;</div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;  }</div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;  <span class="keywordflow">return</span> nodes[prntIdx].leftChild;</div>
<div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;}</div>
<div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160; </div>
<div class="line"><a name="l00403"></a><span class="lineno"><a class="line" href="classhelib_1_1_gen_descriptor.html">  403</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_gen_descriptor.html">GenDescriptor</a></div>
<div class="line"><a name="l00404"></a><span class="lineno">  404</span>&#160;{</div>
<div class="line"><a name="l00405"></a><span class="lineno">  405</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00406"></a><span class="lineno"><a class="line" href="classhelib_1_1_gen_descriptor.html#a58c7969353443b04c963bd021281ca56">  406</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_gen_descriptor.html#a58c7969353443b04c963bd021281ca56">genIdx</a>; <span class="comment">// the index of the corresponding generator in Zm*/(p)</span></div>
<div class="line"><a name="l00407"></a><span class="lineno"><a class="line" href="classhelib_1_1_gen_descriptor.html#a9f39735698306557fa532015dd7c0069">  407</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_gen_descriptor.html#a9f39735698306557fa532015dd7c0069">order</a>;  <span class="comment">// the order of this generator (or a smaller subcube)</span></div>
<div class="line"><a name="l00408"></a><span class="lineno"><a class="line" href="classhelib_1_1_gen_descriptor.html#a55749b52c5b5da836a1fc92f3b2ce1a3">  408</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_gen_descriptor.html#a55749b52c5b5da836a1fc92f3b2ce1a3">good</a>;   <span class="comment">// is this a good generator?</span></div>
<div class="line"><a name="l00409"></a><span class="lineno">  409</span>&#160; </div>
<div class="line"><a name="l00410"></a><span class="lineno"><a class="line" href="classhelib_1_1_gen_descriptor.html#a9833f48c6a7d200fab1ca856f07d67e4">  410</a></span>&#160;  <a class="code" href="classhelib_1_1_gen_descriptor.html#a9833f48c6a7d200fab1ca856f07d67e4">GenDescriptor</a>(<span class="keywordtype">long</span> _order, <span class="keywordtype">bool</span> _good, <span class="keywordtype">long</span> gen = 0) :</div>
<div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;      <a class="code" href="classhelib_1_1_gen_descriptor.html#a58c7969353443b04c963bd021281ca56">genIdx</a>(gen), <a class="code" href="classhelib_1_1_gen_descriptor.html#a9f39735698306557fa532015dd7c0069">order</a>(_order), <a class="code" href="classhelib_1_1_gen_descriptor.html#a55749b52c5b5da836a1fc92f3b2ce1a3">good</a>(_good)</div>
<div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;  {}</div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160; </div>
<div class="line"><a name="l00414"></a><span class="lineno"><a class="line" href="classhelib_1_1_gen_descriptor.html#ae83a6b82c03546d96357371115e6baeb">  414</a></span>&#160;  <a class="code" href="classhelib_1_1_gen_descriptor.html#ae83a6b82c03546d96357371115e6baeb">GenDescriptor</a>() {}</div>
<div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;};</div>
<div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160; </div>
<div class="line"><a name="l00418"></a><span class="lineno"><a class="line" href="classhelib_1_1_sub_dimension.html">  418</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_sub_dimension.html">SubDimension</a></div>
<div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;{</div>
<div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;  <span class="keyword">static</span> <span class="keyword">const</span> NTL::Vec&lt;long&gt; dummyBenes; <span class="comment">// Useful for initialization</span></div>
<div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00422"></a><span class="lineno"><a class="line" href="classhelib_1_1_sub_dimension.html#ad941a846183b7a16fd4ead859429814c">  422</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_sub_dimension.html#ad941a846183b7a16fd4ead859429814c">size</a>; <span class="comment">// size of cube slice, same as &#39;order&#39; in GenDescriptor</span></div>
<div class="line"><a name="l00423"></a><span class="lineno"><a class="line" href="classhelib_1_1_sub_dimension.html#a50b78a52dfc5ef0d29a7aad15425ac5f">  423</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_sub_dimension.html#a50b78a52dfc5ef0d29a7aad15425ac5f">good</a>; <span class="comment">// good or bad</span></div>
<div class="line"><a name="l00424"></a><span class="lineno"><a class="line" href="classhelib_1_1_sub_dimension.html#a324e87ee0005625c836ba3ab4218f076">  424</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_sub_dimension.html#a324e87ee0005625c836ba3ab4218f076">e</a>;    <span class="comment">// shift-by-1 in this sub-dim is done via X -&gt; X^{g^e}</span></div>
<div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160; </div>
<div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;  <span class="comment">// A Benes leaf corresponds to either one or two Benes networks, depending</span></div>
<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;  <span class="comment">// on whether or not it is in the middle. If this object is in the middle</span></div>
<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;  <span class="comment">// then scndBenes.length()==0, else scndBenes.length()&gt;=1. Each of the two</span></div>
<div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;  <span class="comment">// Benes network can be &quot;trivial&quot;, i.e., collapsed to a single layer, which</span></div>
<div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;  <span class="comment">// is denoted by benes.length()==1.</span></div>
<div class="line"><a name="l00431"></a><span class="lineno"><a class="line" href="classhelib_1_1_sub_dimension.html#af9500da8d806ef5a6a506a1102ea0703">  431</a></span>&#160;  NTL::Vec&lt;long&gt; <a class="code" href="classhelib_1_1_sub_dimension.html#af9500da8d806ef5a6a506a1102ea0703">frstBenes</a>;</div>
<div class="line"><a name="l00432"></a><span class="lineno"><a class="line" href="classhelib_1_1_sub_dimension.html#aea9f21674ad5965e474291bf80d05481">  432</a></span>&#160;  NTL::Vec&lt;long&gt; <a class="code" href="classhelib_1_1_sub_dimension.html#aea9f21674ad5965e474291bf80d05481">scndBenes</a>;</div>
<div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160; </div>
<div class="line"><a name="l00434"></a><span class="lineno"><a class="line" href="classhelib_1_1_sub_dimension.html#a531e85e2f833626a32623ec33b66c35f">  434</a></span>&#160;  <span class="keyword">explicit</span> <a class="code" href="classhelib_1_1_sub_dimension.html#a531e85e2f833626a32623ec33b66c35f">SubDimension</a>(<span class="keywordtype">long</span> sz = 0,</div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;                        <span class="keywordtype">bool</span> gd = <span class="keyword">false</span>,</div>
<div class="line"><a name="l00436"></a><span class="lineno">  436</span>&#160;                        <span class="keywordtype">long</span> ee = 0,</div>
<div class="line"><a name="l00437"></a><span class="lineno">  437</span>&#160;                        <span class="keyword">const</span> NTL::Vec&lt;long&gt;&amp; bns1 = dummyBenes,</div>
<div class="line"><a name="l00438"></a><span class="lineno">  438</span>&#160;                        <span class="keyword">const</span> NTL::Vec&lt;long&gt;&amp; bns2 = dummyBenes)</div>
<div class="line"><a name="l00439"></a><span class="lineno">  439</span>&#160;  {</div>
<div class="line"><a name="l00440"></a><span class="lineno">  440</span>&#160;    <a class="code" href="classhelib_1_1_sub_dimension.html#ad941a846183b7a16fd4ead859429814c">size</a> = sz;</div>
<div class="line"><a name="l00441"></a><span class="lineno">  441</span>&#160;    <a class="code" href="classhelib_1_1_sub_dimension.html#a50b78a52dfc5ef0d29a7aad15425ac5f">good</a> = gd;</div>
<div class="line"><a name="l00442"></a><span class="lineno">  442</span>&#160;    <a class="code" href="classhelib_1_1_sub_dimension.html#a324e87ee0005625c836ba3ab4218f076">e</a> = ee;</div>
<div class="line"><a name="l00443"></a><span class="lineno">  443</span>&#160;    <a class="code" href="classhelib_1_1_sub_dimension.html#af9500da8d806ef5a6a506a1102ea0703">frstBenes</a> = bns1;</div>
<div class="line"><a name="l00444"></a><span class="lineno">  444</span>&#160;    <a class="code" href="classhelib_1_1_sub_dimension.html#aea9f21674ad5965e474291bf80d05481">scndBenes</a> = bns2;</div>
<div class="line"><a name="l00445"></a><span class="lineno">  445</span>&#160;  }</div>
<div class="line"><a name="l00446"></a><span class="lineno">  446</span>&#160; </div>
<div class="line"><a name="l00447"></a><span class="lineno"><a class="line" href="classhelib_1_1_sub_dimension.html#a0222f2c0f92b49b8ab424880763885ff">  447</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_sub_dimension.html#a0222f2c0f92b49b8ab424880763885ff">totalLength</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1_sub_dimension.html#af9500da8d806ef5a6a506a1102ea0703">frstBenes</a>.length() + <a class="code" href="classhelib_1_1_sub_dimension.html#aea9f21674ad5965e474291bf80d05481">scndBenes</a>.length(); }</div>
<div class="line"><a name="l00448"></a><span class="lineno">  448</span>&#160;  <span class="comment">/*  SubDimension&amp; operator=(const SubDimension&amp; other)</span></div>
<div class="line"><a name="l00449"></a><span class="lineno">  449</span>&#160;<span class="comment">    { genIdx=other.genIdx; size=other.size;</span></div>
<div class="line"><a name="l00450"></a><span class="lineno">  450</span>&#160;<span class="comment">      e=other.e; good=other.good; benes=other.benes;</span></div>
<div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160;<span class="comment">      return *this;</span></div>
<div class="line"><a name="l00452"></a><span class="lineno">  452</span>&#160;<span class="comment">      }</span></div>
<div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;<span class="comment">  */</span></div>
<div class="line"><a name="l00454"></a><span class="lineno">  454</span>&#160;  <span class="keyword">friend</span> std::ostream&amp; <a class="code" href="classhelib_1_1_sub_dimension.html#abc770e9e4566f90224c7cfbb43c20249">operator&lt;&lt;</a>(std::ostream&amp; s, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sub_dimension.html">SubDimension</a>&amp; tree);</div>
<div class="line"><a name="l00455"></a><span class="lineno">  455</span>&#160;};</div>
<div class="line"><a name="l00456"></a><span class="lineno"><a class="line" href="namespacehelib.html#a22b83b7df1af539c07c804d7888448ce">  456</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="classhelib_1_1_full_binary_tree.html">FullBinaryTree&lt;SubDimension&gt;</a> <a class="code" href="namespacehelib.html#a22b83b7df1af539c07c804d7888448ce">OneGeneratorTree</a>; <span class="comment">// tree for one generator</span></div>
<div class="line"><a name="l00457"></a><span class="lineno">  457</span>&#160; </div>
<div class="line"><a name="l00459"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html">  459</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_generator_trees.html">GeneratorTrees</a></div>
<div class="line"><a name="l00460"></a><span class="lineno">  460</span>&#160;{</div>
<div class="line"><a name="l00461"></a><span class="lineno">  461</span>&#160;  <span class="keywordtype">long</span> depth; <span class="comment">// How many layers in this permutation network</span></div>
<div class="line"><a name="l00462"></a><span class="lineno">  462</span>&#160;  NTL::Vec&lt;OneGeneratorTree&gt; trees;</div>
<div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;  <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a> map2cube, map2array;</div>
<div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160; </div>
<div class="line"><a name="l00465"></a><span class="lineno">  465</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00466"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#a42a860ff4a6aeddeb35596b8ced46af6">  466</a></span>&#160;  <a class="code" href="classhelib_1_1_generator_trees.html#a42a860ff4a6aeddeb35596b8ced46af6">GeneratorTrees</a>() { depth = 0; } <span class="comment">// default constructor</span></div>
<div class="line"><a name="l00467"></a><span class="lineno">  467</span>&#160; </div>
<div class="line"><a name="l00468"></a><span class="lineno">  468</span>&#160;  <span class="comment">// GeneratorTrees(const Vec&lt;OneGeneratorTree&gt;&amp; _trees): trees(_trees)</span></div>
<div class="line"><a name="l00469"></a><span class="lineno">  469</span>&#160;  <span class="comment">//  {depth=0;}</span></div>
<div class="line"><a name="l00470"></a><span class="lineno">  470</span>&#160;  <span class="comment">//</span></div>
<div class="line"><a name="l00471"></a><span class="lineno">  471</span>&#160;  <span class="comment">// Initialize trees with only the roots.</span></div>
<div class="line"><a name="l00472"></a><span class="lineno">  472</span>&#160;  <span class="comment">//  GeneratorTrees(const Vec&lt;SubDimension&gt;&amp; dims);</span></div>
<div class="line"><a name="l00473"></a><span class="lineno">  473</span>&#160; </div>
<div class="line"><a name="l00474"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#a08df7eda4dc9cb44c6900c2b3bea0cda">  474</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_generator_trees.html#a08df7eda4dc9cb44c6900c2b3bea0cda">numLayers</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> depth; } <span class="comment">// depth of permutation network</span></div>
<div class="line"><a name="l00475"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#a409877a65286742bce5dfd602c0f61fb">  475</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_generator_trees.html#a409877a65286742bce5dfd602c0f61fb">numTrees</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> trees.length(); }   <span class="comment">// how many trees</span></div>
<div class="line"><a name="l00476"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#aeba4a1ecbde123ce39cf207b2b999d9c">  476</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_generator_trees.html#aeba4a1ecbde123ce39cf207b2b999d9c">getSize</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> map2cube.length(); } <span class="comment">// hypercube size</span></div>
<div class="line"><a name="l00477"></a><span class="lineno">  477</span>&#160; </div>
<div class="line"><a name="l00478"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#a926596f994e0f372a6115c8518e63961">  478</a></span>&#160;  <a class="code" href="classhelib_1_1_full_binary_tree.html">OneGeneratorTree</a>&amp; <a class="code" href="classhelib_1_1_generator_trees.html#a926596f994e0f372a6115c8518e63961">operator[]</a>(<span class="keywordtype">long</span> i) { <span class="keywordflow">return</span> trees[i]; }</div>
<div class="line"><a name="l00479"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#a5e5ce4dbec3ce781150841eb86ca0171">  479</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_full_binary_tree.html">OneGeneratorTree</a>&amp; <a class="code" href="classhelib_1_1_generator_trees.html#a5e5ce4dbec3ce781150841eb86ca0171">operator[]</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> trees[i]; }</div>
<div class="line"><a name="l00480"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#ada5044b425b9e1a287c43af7985721ee">  480</a></span>&#160;  <a class="code" href="classhelib_1_1_full_binary_tree.html">OneGeneratorTree</a>&amp; <a class="code" href="classhelib_1_1_generator_trees.html#ada5044b425b9e1a287c43af7985721ee">at</a>(<span class="keywordtype">long</span> i) { <span class="keywordflow">return</span> trees.<a class="code" href="classhelib_1_1_full_binary_tree.html#ae547d2343a76c7aea8cc861ef571b4d4">at</a>(i); }</div>
<div class="line"><a name="l00481"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#acc20c3f1ee7feaf70e5d9eeda5768c59">  481</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_full_binary_tree.html">OneGeneratorTree</a>&amp; <a class="code" href="classhelib_1_1_generator_trees.html#acc20c3f1ee7feaf70e5d9eeda5768c59">at</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> trees.<a class="code" href="classhelib_1_1_full_binary_tree.html#ae547d2343a76c7aea8cc861ef571b4d4">at</a>(i); }</div>
<div class="line"><a name="l00482"></a><span class="lineno">  482</span>&#160; </div>
<div class="line"><a name="l00483"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#a6a089d3a37735f4dc2263c6e50919c04">  483</a></span>&#160;  <a class="code" href="classhelib_1_1_full_binary_tree.html">OneGeneratorTree</a>&amp; <a class="code" href="classhelib_1_1_generator_trees.html#a6a089d3a37735f4dc2263c6e50919c04">getGenTree</a>(<span class="keywordtype">long</span> i) { <span class="keywordflow">return</span> trees.<a class="code" href="classhelib_1_1_full_binary_tree.html#ae547d2343a76c7aea8cc861ef571b4d4">at</a>(i); }</div>
<div class="line"><a name="l00484"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#a14ea69288666f85258a6879a8cf603fd">  484</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_full_binary_tree.html">OneGeneratorTree</a>&amp; <a class="code" href="classhelib_1_1_generator_trees.html#a14ea69288666f85258a6879a8cf603fd">getGenTree</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> trees.<a class="code" href="classhelib_1_1_full_binary_tree.html#ae547d2343a76c7aea8cc861ef571b4d4">at</a>(i); }</div>
<div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160; </div>
<div class="line"><a name="l00486"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#a743b844dbf992516d6ff6019aa49f54d">  486</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; <a class="code" href="classhelib_1_1_generator_trees.html#a743b844dbf992516d6ff6019aa49f54d">mapToCube</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> map2cube; }</div>
<div class="line"><a name="l00487"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#af1fc160bcf09404218e1601140f5ff05">  487</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; <a class="code" href="classhelib_1_1_generator_trees.html#af1fc160bcf09404218e1601140f5ff05">mapToArray</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> map2array; }</div>
<div class="line"><a name="l00488"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#abae76f45adc4861d192e56f0c15f33a0">  488</a></span>&#160;  <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; <a class="code" href="classhelib_1_1_generator_trees.html#abae76f45adc4861d192e56f0c15f33a0">mapToCube</a>() { <span class="keywordflow">return</span> map2cube; }</div>
<div class="line"><a name="l00489"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#a6dbc3e62f5d58219c9b1bb6f1e5ff603">  489</a></span>&#160;  <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; <a class="code" href="classhelib_1_1_generator_trees.html#a6dbc3e62f5d58219c9b1bb6f1e5ff603">mapToArray</a>() { <span class="keywordflow">return</span> map2array; }</div>
<div class="line"><a name="l00490"></a><span class="lineno">  490</span>&#160; </div>
<div class="line"><a name="l00491"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#aa5c5e1b7c602e7b870ed63fd6df7d2a0">  491</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_generator_trees.html#aa5c5e1b7c602e7b870ed63fd6df7d2a0">mapToCube</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> map2cube[i]; }</div>
<div class="line"><a name="l00492"></a><span class="lineno"><a class="line" href="classhelib_1_1_generator_trees.html#a5986fc2b3d3ca6414583fb61355e4719">  492</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_generator_trees.html#a5986fc2b3d3ca6414583fb61355e4719">mapToArray</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> map2array[i]; }</div>
<div class="line"><a name="l00493"></a><span class="lineno">  493</span>&#160; </div>
<div class="line"><a name="l00496"></a><span class="lineno">  496</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_generator_trees.html#a93858852234fd096960f689cf2bf00eb">getCubeDims</a>(NTL::Vec&lt;long&gt;&amp; dims) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00497"></a><span class="lineno">  497</span>&#160; </div>
<div class="line"><a name="l00500"></a><span class="lineno">  500</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_generator_trees.html#abb421d196c02799e1611be09eaa71220">getCubeSubDims</a>(NTL::Vec&lt;long&gt;&amp; dims) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00501"></a><span class="lineno">  501</span>&#160; </div>
<div class="line"><a name="l00502"></a><span class="lineno">  502</span>&#160;  <span class="comment">// Returns coordinates of i relative to leaves of the tree</span></div>
<div class="line"><a name="l00503"></a><span class="lineno">  503</span>&#160;  <span class="comment">//  void getCoordinates(Vec&lt;long&gt;&amp;, long i) const;</span></div>
<div class="line"><a name="l00504"></a><span class="lineno">  504</span>&#160; </div>
<div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_generator_trees.html#abde39d00c689b409268969f7e29414be">buildOptimalTrees</a>(<span class="keyword">const</span> NTL::Vec&lt;GenDescriptor&gt;&amp; vec, <span class="keywordtype">long</span> depthBound);</div>
<div class="line"><a name="l00510"></a><span class="lineno">  510</span>&#160; </div>
<div class="line"><a name="l00527"></a><span class="lineno">  527</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_generator_trees.html#a2d5d127d11b5736b62ce5e5dd51d7927">ComputeCubeMapping</a>();</div>
<div class="line"><a name="l00528"></a><span class="lineno">  528</span>&#160; </div>
<div class="line"><a name="l00529"></a><span class="lineno">  529</span>&#160;  <span class="keyword">friend</span> std::ostream&amp; <a class="code" href="classhelib_1_1_generator_trees.html#ae6360cb4b9adbf55b91ac2cdbe5515df">operator&lt;&lt;</a>(std::ostream&amp; s, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_generator_trees.html">GeneratorTrees</a>&amp; t);</div>
<div class="line"><a name="l00530"></a><span class="lineno">  530</span>&#160;};</div>
<div class="line"><a name="l00531"></a><span class="lineno">  531</span>&#160; </div>
<div class="line"><a name="l00532"></a><span class="lineno">  532</span>&#160;<span class="comment">// Permutation networks</span></div>
<div class="line"><a name="l00533"></a><span class="lineno">  533</span>&#160; </div>
<div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160;<span class="keyword">class </span>Ctxt;</div>
<div class="line"><a name="l00535"></a><span class="lineno">  535</span>&#160;<span class="keyword">class </span>EncryptedArray;</div>
<div class="line"><a name="l00536"></a><span class="lineno">  536</span>&#160;<span class="keyword">class </span>PermNetwork;</div>
<div class="line"><a name="l00537"></a><span class="lineno">  537</span>&#160; </div>
<div class="line"><a name="l00540"></a><span class="lineno"><a class="line" href="classhelib_1_1_perm_net_layer.html">  540</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_perm_net_layer.html">PermNetLayer</a></div>
<div class="line"><a name="l00541"></a><span class="lineno">  541</span>&#160;{</div>
<div class="line"><a name="l00542"></a><span class="lineno">  542</span>&#160;  <span class="keywordtype">long</span> genIdx; <span class="comment">// shift-by-1 in this layer is done via X -&gt; X^{g^e}</span></div>
<div class="line"><a name="l00543"></a><span class="lineno">  543</span>&#160;  <span class="keywordtype">long</span> e;</div>
<div class="line"><a name="l00544"></a><span class="lineno">  544</span>&#160;  NTL::Vec&lt;long&gt; shifts; <span class="comment">// shifts[i] is how much to shift slot i</span></div>
<div class="line"><a name="l00545"></a><span class="lineno">  545</span>&#160;  <span class="keywordtype">bool</span> isID; <span class="comment">// a silly optimization, does this layer compute the identity?</span></div>
<div class="line"><a name="l00546"></a><span class="lineno">  546</span>&#160; </div>
<div class="line"><a name="l00547"></a><span class="lineno"><a class="line" href="classhelib_1_1_perm_net_layer.html#a4457a4e3ee6834f25b163dea4afa122f">  547</a></span>&#160;  <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classhelib_1_1_perm_network.html">PermNetwork</a>;</div>
<div class="line"><a name="l00548"></a><span class="lineno">  548</span>&#160;  <span class="keyword">friend</span> std::ostream&amp; <a class="code" href="classhelib_1_1_perm_net_layer.html#a414c92ddb59a5b1623e88f00f1e05770">operator&lt;&lt;</a>(std::ostream&amp; s, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_perm_network.html">PermNetwork</a>&amp; net);</div>
<div class="line"><a name="l00549"></a><span class="lineno">  549</span>&#160; </div>
<div class="line"><a name="l00550"></a><span class="lineno">  550</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00551"></a><span class="lineno"><a class="line" href="classhelib_1_1_perm_net_layer.html#ac4bb96428da1ee9e326889547c7678c2">  551</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_perm_net_layer.html#ac4bb96428da1ee9e326889547c7678c2">getGenIdx</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> genIdx; }</div>
<div class="line"><a name="l00552"></a><span class="lineno"><a class="line" href="classhelib_1_1_perm_net_layer.html#a96eed86392275a336f737eb122515cac">  552</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_perm_net_layer.html#a96eed86392275a336f737eb122515cac">getE</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> e; }</div>
<div class="line"><a name="l00553"></a><span class="lineno"><a class="line" href="classhelib_1_1_perm_net_layer.html#a89a021ac775c621b4c55b9e96bde52c1">  553</a></span>&#160;  <span class="keyword">const</span> NTL::Vec&lt;long&gt;&amp; <a class="code" href="classhelib_1_1_perm_net_layer.html#a89a021ac775c621b4c55b9e96bde52c1">getShifts</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> shifts; }</div>
<div class="line"><a name="l00554"></a><span class="lineno"><a class="line" href="classhelib_1_1_perm_net_layer.html#ac369482c12aa6a9301e3cc19f8607350">  554</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1_perm_net_layer.html#ac369482c12aa6a9301e3cc19f8607350">isIdentity</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> isID; }</div>
<div class="line"><a name="l00555"></a><span class="lineno">  555</span>&#160;};</div>
<div class="line"><a name="l00556"></a><span class="lineno">  556</span>&#160; </div>
<div class="line"><a name="l00558"></a><span class="lineno"><a class="line" href="classhelib_1_1_perm_network.html">  558</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_perm_network.html">PermNetwork</a></div>
<div class="line"><a name="l00559"></a><span class="lineno">  559</span>&#160;{</div>
<div class="line"><a name="l00560"></a><span class="lineno">  560</span>&#160;  NTL::Vec&lt;PermNetLayer&gt; layers;</div>
<div class="line"><a name="l00561"></a><span class="lineno">  561</span>&#160; </div>
<div class="line"><a name="l00563"></a><span class="lineno">  563</span>&#160;  <span class="keywordtype">void</span> setLayers4Leaf(<span class="keywordtype">long</span> lyrIdx,</div>
<div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160;                      <span class="keyword">const</span> <a class="code" href="classhelib_1_1_col_perm.html">ColPerm</a>&amp; p,</div>
<div class="line"><a name="l00565"></a><span class="lineno">  565</span>&#160;                      <span class="keyword">const</span> NTL::Vec&lt;long&gt;&amp; benesLvls,</div>
<div class="line"><a name="l00566"></a><span class="lineno">  566</span>&#160;                      <span class="keywordtype">long</span> gIdx,</div>
<div class="line"><a name="l00567"></a><span class="lineno">  567</span>&#160;                      <span class="keyword">const</span> <a class="code" href="classhelib_1_1_sub_dimension.html">SubDimension</a>&amp; leafData,</div>
<div class="line"><a name="l00568"></a><span class="lineno">  568</span>&#160;                      <span class="keyword">const</span> <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; map2cube);</div>
<div class="line"><a name="l00569"></a><span class="lineno">  569</span>&#160; </div>
<div class="line"><a name="l00570"></a><span class="lineno">  570</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00571"></a><span class="lineno"><a class="line" href="classhelib_1_1_perm_network.html#ac28b4e5256433eb0dd2c51c5de899482">  571</a></span>&#160;  <a class="code" href="classhelib_1_1_perm_network.html#ac28b4e5256433eb0dd2c51c5de899482">PermNetwork</a>(){}; <span class="comment">// empty network</span></div>
<div class="line"><a name="l00572"></a><span class="lineno"><a class="line" href="classhelib_1_1_perm_network.html#ab95327c63d9e120839d5e224b7baf418">  572</a></span>&#160;  <a class="code" href="classhelib_1_1_perm_network.html#ab95327c63d9e120839d5e224b7baf418">PermNetwork</a>(<span class="keyword">const</span> <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; pi, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_generator_trees.html">GeneratorTrees</a>&amp; trees)</div>
<div class="line"><a name="l00573"></a><span class="lineno">  573</span>&#160;  {</div>
<div class="line"><a name="l00574"></a><span class="lineno">  574</span>&#160;    <a class="code" href="classhelib_1_1_perm_network.html#a09257bcc62d95f5c7c1fc9a31ae85c9b">buildNetwork</a>(pi, trees);</div>
<div class="line"><a name="l00575"></a><span class="lineno">  575</span>&#160;  }</div>
<div class="line"><a name="l00576"></a><span class="lineno">  576</span>&#160; </div>
<div class="line"><a name="l00577"></a><span class="lineno"><a class="line" href="classhelib_1_1_perm_network.html#ac59fb18162d230d08cdf8040a52aa994">  577</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1_perm_network.html#ac59fb18162d230d08cdf8040a52aa994">depth</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> layers.length(); }</div>
<div class="line"><a name="l00578"></a><span class="lineno">  578</span>&#160; </div>
<div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_perm_network.html#a09257bcc62d95f5c7c1fc9a31ae85c9b">buildNetwork</a>(<span class="keyword">const</span> <a class="code" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a>&amp; pi, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_generator_trees.html">GeneratorTrees</a>&amp; trees);</div>
<div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160; </div>
<div class="line"><a name="l00584"></a><span class="lineno">  584</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_perm_network.html#ae7a8e3f59636f1318ed64479dbd7c1e3">applyToCtxt</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; c, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array.html">EncryptedArray</a>&amp; ea) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00585"></a><span class="lineno">  585</span>&#160; </div>
<div class="line"><a name="l00587"></a><span class="lineno">  587</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_perm_network.html#a4ba09dd7c8426ea252470ca9d9219c02">applyToCube</a>(<a class="code" href="classhelib_1_1_hyper_cube.html">HyperCube&lt;long&gt;</a>&amp; v) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00588"></a><span class="lineno">  588</span>&#160; </div>
<div class="line"><a name="l00590"></a><span class="lineno"><a class="line" href="classhelib_1_1_perm_network.html#a0f67515423aedfcefac0970fb724cb0b">  590</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_perm_network.html#a0f67515423aedfcefac0970fb724cb0b">applyToPtxt</a>(NTL::ZZX&amp; p, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array.html">EncryptedArray</a>&amp; ea) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00591"></a><span class="lineno">  591</span>&#160; </div>
<div class="line"><a name="l00592"></a><span class="lineno"><a class="line" href="classhelib_1_1_perm_network.html#ab9c057c00b571e77e5fb1d87d3145c05">  592</a></span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_perm_net_layer.html">PermNetLayer</a>&amp; <a class="code" href="classhelib_1_1_perm_network.html#ab9c057c00b571e77e5fb1d87d3145c05">getLayer</a>(<span class="keywordtype">long</span> i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> layers[i]; }</div>
<div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160; </div>
<div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160;  <span class="keyword">friend</span> std::ostream&amp; <a class="code" href="classhelib_1_1_perm_network.html#a414c92ddb59a5b1623e88f00f1e05770">operator&lt;&lt;</a>(std::ostream&amp; s, <span class="keyword">const</span> <a class="code" href="classhelib_1_1_perm_network.html">PermNetwork</a>&amp; net);</div>
<div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;};</div>
<div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160; </div>
<div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160;} <span class="comment">// namespace helib</span></div>
<div class="line"><a name="l00598"></a><span class="lineno">  598</span>&#160; </div>
<div class="line"><a name="l00599"></a><span class="lineno">  599</span>&#160;<span class="preprocessor">#endif // ifndef HELIB_PERMUTATIONS_H</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclasshelib_1_1_gen_descriptor_html_a9f39735698306557fa532015dd7c0069"><div class="ttname"><a href="classhelib_1_1_gen_descriptor.html#a9f39735698306557fa532015dd7c0069">helib::GenDescriptor::order</a></div><div class="ttdeci">long order</div><div class="ttdef"><b>Definition:</b> permutations.h:407</div></div>
<div class="ttc" id="aclasshelib_1_1_general_benes_network_html_a8ab3837bf4ffb077d12aaea5e923993b"><div class="ttname"><a href="classhelib_1_1_general_benes_network.html#a8ab3837bf4ffb077d12aaea5e923993b">helib::GeneralBenesNetwork::getLevel</a></div><div class="ttdeci">const NTL::Vec&lt; short &gt; &amp; getLevel(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:199</div></div>
<div class="ttc" id="aclasshelib_1_1_sub_dimension_html_af9500da8d806ef5a6a506a1102ea0703"><div class="ttname"><a href="classhelib_1_1_sub_dimension.html#af9500da8d806ef5a6a506a1102ea0703">helib::SubDimension::frstBenes</a></div><div class="ttdeci">NTL::Vec&lt; long &gt; frstBenes</div><div class="ttdef"><b>Definition:</b> permutations.h:431</div></div>
<div class="ttc" id="anamespacehelib_html_a22b83b7df1af539c07c804d7888448ce"><div class="ttname"><a href="namespacehelib.html#a22b83b7df1af539c07c804d7888448ce">helib::OneGeneratorTree</a></div><div class="ttdeci">FullBinaryTree&lt; SubDimension &gt; OneGeneratorTree</div><div class="ttdef"><b>Definition:</b> permutations.h:456</div></div>
<div class="ttc" id="aclasshelib_1_1_tree_node_html_a76d17b68beac47df9eebe534f3b285d6"><div class="ttname"><a href="classhelib_1_1_tree_node.html#a76d17b68beac47df9eebe534f3b285d6">helib::TreeNode::getPrev</a></div><div class="ttdeci">long getPrev() const</div><div class="ttdef"><b>Definition:</b> permutations.h:251</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a2322753e1a3b66a4c8311a94cd0b4f8a"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a2322753e1a3b66a4c8311a94cd0b4f8a">helib::FullBinaryTree::size</a></div><div class="ttdeci">long size()</div><div class="ttdef"><b>Definition:</b> permutations.h:295</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_a42a860ff4a6aeddeb35596b8ced46af6"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#a42a860ff4a6aeddeb35596b8ced46af6">helib::GeneratorTrees::GeneratorTrees</a></div><div class="ttdeci">GeneratorTrees()</div><div class="ttdef"><b>Definition:</b> permutations.h:466</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_network_html_ae7a8e3f59636f1318ed64479dbd7c1e3"><div class="ttname"><a href="classhelib_1_1_perm_network.html#ae7a8e3f59636f1318ed64479dbd7c1e3">helib::PermNetwork::applyToCtxt</a></div><div class="ttdeci">void applyToCtxt(Ctxt &amp;c, const EncryptedArray &amp;ea) const</div><div class="ttdoc">Apply network to permute a ciphertext.</div><div class="ttdef"><b>Definition:</b> PermNetwork.cpp:217</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_network_html_a4ba09dd7c8426ea252470ca9d9219c02"><div class="ttname"><a href="classhelib_1_1_perm_network.html#a4ba09dd7c8426ea252470ca9d9219c02">helib::PermNetwork::applyToCube</a></div><div class="ttdeci">void applyToCube(HyperCube&lt; long &gt; &amp;v) const</div><div class="ttdoc">Apply network to array, used mostly for debugging.</div><div class="ttdef"><b>Definition:</b> PermNetwork.cpp:149</div></div>
<div class="ttc" id="aclasshelib_1_1_tree_node_html"><div class="ttname"><a href="classhelib_1_1_tree_node.html">helib::TreeNode</a></div><div class="ttdoc">A node in a full binary tree.</div><div class="ttdef"><b>Definition:</b> permutations.h:233</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a5a9c2de5be1d65990e89672b945425c9"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a5a9c2de5be1d65990e89672b945425c9">helib::FullBinaryTree::prevLeaf</a></div><div class="ttdeci">long prevLeaf(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:312</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_network_html_ab9c057c00b571e77e5fb1d87d3145c05"><div class="ttname"><a href="classhelib_1_1_perm_network.html#ab9c057c00b571e77e5fb1d87d3145c05">helib::PermNetwork::getLayer</a></div><div class="ttdeci">const PermNetLayer &amp; getLayer(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:592</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_network_html_ac59fb18162d230d08cdf8040a52aa994"><div class="ttname"><a href="classhelib_1_1_perm_network.html#ac59fb18162d230d08cdf8040a52aa994">helib::PermNetwork::depth</a></div><div class="ttdeci">long depth() const</div><div class="ttdef"><b>Definition:</b> permutations.h:577</div></div>
<div class="ttc" id="anamespacehelib_html_aca37b5e05bffd4550c995e83594d7325"><div class="ttname"><a href="namespacehelib.html#aca37b5e05bffd4550c995e83594d7325">helib::assertTrue</a></div><div class="ttdeci">void assertTrue(const T &amp;value, const std::string &amp;message)</div><div class="ttdef"><b>Definition:</b> assertions.h:61</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a149080a92be86e4e42fb2b92ee1bb355"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a149080a92be86e4e42fb2b92ee1bb355">helib::FullBinaryTree::firstLeaf</a></div><div class="ttdeci">long firstLeaf() const</div><div class="ttdef"><b>Definition:</b> permutations.h:310</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_aeb54f77e3a0471e40d7a5f6244a02c85"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#aeb54f77e3a0471e40d7a5f6244a02c85">helib::FullBinaryTree::leftChildIdx</a></div><div class="ttdeci">long leftChildIdx(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:317</div></div>
<div class="ttc" id="aclasshelib_1_1_col_perm_html"><div class="ttname"><a href="classhelib_1_1_col_perm.html">helib::ColPerm</a></div><div class="ttdoc">Permuting a single dimension (column) of a hypercube.</div><div class="ttdef"><b>Definition:</b> permutations.h:91</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a7a4517a28a0c190db906951397868f84"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a7a4517a28a0c190db906951397868f84">helib::FullBinaryTree::DataOfNode</a></div><div class="ttdeci">const T &amp; DataOfNode(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:304</div></div>
<div class="ttc" id="aclasshelib_1_1_col_perm_html_ab411c50c5ac089fb1902e27ccddea97b"><div class="ttname"><a href="classhelib_1_1_col_perm.html#ab411c50c5ac089fb1902e27ccddea97b">helib::ColPerm::makeExplicit</a></div><div class="ttdeci">void makeExplicit(Permut &amp;out) const</div><div class="ttdef"><b>Definition:</b> permutations.cpp:110</div></div>
<div class="ttc" id="aclasshelib_1_1_hyper_cube_html_a0f68841b322376a580348abfb7ab0274"><div class="ttname"><a href="classhelib_1_1_hyper_cube.html#a0f68841b322376a580348abfb7ab0274">helib::HyperCube&lt; long &gt;::getNumDims</a></div><div class="ttdeci">long getNumDims() const</div><div class="ttdoc">number of dimensions</div><div class="ttdef"><b>Definition:</b> hypercube.h:276</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a188e0896cc5316b9cc5a6bcb6a737fc0"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a188e0896cc5316b9cc5a6bcb6a737fc0">helib::FullBinaryTree::rightChildIdx</a></div><div class="ttdeci">long rightChildIdx(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:318</div></div>
<div class="ttc" id="aclasshelib_1_1_col_perm_html_a654d1378767cfeb58d987a62464e682b"><div class="ttname"><a href="classhelib_1_1_col_perm.html#a654d1378767cfeb58d987a62464e682b">helib::ColPerm::getShiftAmounts</a></div><div class="ttdeci">long getShiftAmounts(Permut &amp;out) const</div><div class="ttdef"><b>Definition:</b> permutations.cpp:125</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_network_html_a0f67515423aedfcefac0970fb724cb0b"><div class="ttname"><a href="classhelib_1_1_perm_network.html#a0f67515423aedfcefac0970fb724cb0b">helib::PermNetwork::applyToPtxt</a></div><div class="ttdeci">void applyToPtxt(NTL::ZZX &amp;p, const EncryptedArray &amp;ea) const</div><div class="ttdoc">Apply network to plaintext polynomial, used mostly for debugging.</div></div>
<div class="ttc" id="aclasshelib_1_1_general_benes_network_html_ad12ab0c6ab25a9576d4f52102036d2ec"><div class="ttname"><a href="classhelib_1_1_general_benes_network.html#ad12ab0c6ab25a9576d4f52102036d2ec">helib::GeneralBenesNetwork::levelToDepthMap</a></div><div class="ttdeci">static long levelToDepthMap(UNUSED long n, long k, long i)</div><div class="ttdef"><b>Definition:</b> permutations.h:178</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a6342b220b460dd812fb76e47ff58d089"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a6342b220b460dd812fb76e47ff58d089">helib::FullBinaryTree::getAuxKey</a></div><div class="ttdeci">long getAuxKey() const</div><div class="ttdef"><b>Definition:</b> permutations.h:306</div></div>
<div class="ttc" id="aclasshelib_1_1_sub_dimension_html_ad941a846183b7a16fd4ead859429814c"><div class="ttname"><a href="classhelib_1_1_sub_dimension.html#ad941a846183b7a16fd4ead859429814c">helib::SubDimension::size</a></div><div class="ttdeci">long size</div><div class="ttdef"><b>Definition:</b> permutations.h:422</div></div>
<div class="ttc" id="aclasshelib_1_1_general_benes_network_html_ae0d074af92f13a6e09424f07348e08cd"><div class="ttname"><a href="classhelib_1_1_general_benes_network.html#ae0d074af92f13a6e09424f07348e08cd">helib::GeneralBenesNetwork::testNetwork</a></div><div class="ttdeci">bool testNetwork(const Permut &amp;perm) const</div><div class="ttdef"><b>Definition:</b> BenesNetwork.cpp:308</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html">helib::EncryptedArray</a></div><div class="ttdoc">A simple wrapper for a smart pointer to an EncryptedArrayBase. This is the interface that higher-leve...</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1237</div></div>
<div class="ttc" id="aclasshelib_1_1_sub_dimension_html_a0222f2c0f92b49b8ab424880763885ff"><div class="ttname"><a href="classhelib_1_1_sub_dimension.html#a0222f2c0f92b49b8ab424880763885ff">helib::SubDimension::totalLength</a></div><div class="ttdeci">long totalLength() const</div><div class="ttdef"><b>Definition:</b> permutations.h:447</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a3865814c12a478cf58958ff8b9cdec77"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a3865814c12a478cf58958ff8b9cdec77">helib::FullBinaryTree::collapseToRoot</a></div><div class="ttdeci">void collapseToRoot()</div><div class="ttdoc">Remove all nodes in the tree except for the root.</div><div class="ttdef"><b>Definition:</b> permutations.h:339</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_a5e5ce4dbec3ce781150841eb86ca0171"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#a5e5ce4dbec3ce781150841eb86ca0171">helib::GeneratorTrees::operator[]</a></div><div class="ttdeci">const OneGeneratorTree &amp; operator[](long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:479</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_net_layer_html_a96eed86392275a336f737eb122515cac"><div class="ttname"><a href="classhelib_1_1_perm_net_layer.html#a96eed86392275a336f737eb122515cac">helib::PermNetLayer::getE</a></div><div class="ttdeci">long getE() const</div><div class="ttdef"><b>Definition:</b> permutations.h:552</div></div>
<div class="ttc" id="aclasshelib_1_1_sub_dimension_html_a50b78a52dfc5ef0d29a7aad15425ac5f"><div class="ttname"><a href="classhelib_1_1_sub_dimension.html#a50b78a52dfc5ef0d29a7aad15425ac5f">helib::SubDimension::good</a></div><div class="ttdeci">bool good</div><div class="ttdef"><b>Definition:</b> permutations.h:423</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_a743b844dbf992516d6ff6019aa49f54d"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#a743b844dbf992516d6ff6019aa49f54d">helib::GeneratorTrees::mapToCube</a></div><div class="ttdeci">const Permut &amp; mapToCube() const</div><div class="ttdef"><b>Definition:</b> permutations.h:486</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_network_html_ac28b4e5256433eb0dd2c51c5de899482"><div class="ttname"><a href="classhelib_1_1_perm_network.html#ac28b4e5256433eb0dd2c51c5de899482">helib::PermNetwork::PermNetwork</a></div><div class="ttdeci">PermNetwork()</div><div class="ttdef"><b>Definition:</b> permutations.h:571</div></div>
<div class="ttc" id="anamespacehelib_html_a8e36344202aac3b245f5ba71f69a3e8b"><div class="ttname"><a href="namespacehelib.html#a8e36344202aac3b245f5ba71f69a3e8b">helib::assertInRange</a></div><div class="ttdeci">void assertInRange(const T &amp;elem, const T &amp;min, const T &amp;max, const std::string &amp;message, bool right_inclusive=false)</div><div class="ttdef"><b>Definition:</b> assertions.h:183</div></div>
<div class="ttc" id="aclasshelib_1_1_gen_descriptor_html_ae83a6b82c03546d96357371115e6baeb"><div class="ttname"><a href="classhelib_1_1_gen_descriptor.html#ae83a6b82c03546d96357371115e6baeb">helib::GenDescriptor::GenDescriptor</a></div><div class="ttdeci">GenDescriptor()</div><div class="ttdef"><b>Definition:</b> permutations.h:414</div></div>
<div class="ttc" id="ahypercube_8h_html"><div class="ttname"><a href="hypercube_8h.html">hypercube.h</a></div><div class="ttdoc">Hypercubes and their slices.</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a35b6be44ab7a1d5664c6e8f012d5f58a"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a35b6be44ab7a1d5664c6e8f012d5f58a">helib::FullBinaryTree::at</a></div><div class="ttdeci">const TreeNode&lt; T &gt; &amp; at(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:301</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_a6dbc3e62f5d58219c9b1bb6f1e5ff603"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#a6dbc3e62f5d58219c9b1bb6f1e5ff603">helib::GeneratorTrees::mapToArray</a></div><div class="ttdeci">Permut &amp; mapToArray()</div><div class="ttdef"><b>Definition:</b> permutations.h:489</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_network_html_a414c92ddb59a5b1623e88f00f1e05770"><div class="ttname"><a href="classhelib_1_1_perm_network.html#a414c92ddb59a5b1623e88f00f1e05770">helib::PermNetwork::operator&lt;&lt;</a></div><div class="ttdeci">friend std::ostream &amp; operator&lt;&lt;(std::ostream &amp;s, const PermNetwork &amp;net)</div><div class="ttdef"><b>Definition:</b> PermNetwork.cpp:20</div></div>
<div class="ttc" id="amatching_8h_html"><div class="ttname"><a href="matching_8h.html">matching.h</a></div><div class="ttdoc">Classes and functions for max-flow in a generic graph.</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_a93858852234fd096960f689cf2bf00eb"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#a93858852234fd096960f689cf2bf00eb">helib::GeneratorTrees::getCubeDims</a></div><div class="ttdeci">void getCubeDims(NTL::Vec&lt; long &gt; &amp;dims) const</div><div class="ttdef"><b>Definition:</b> permutations.cpp:376</div></div>
<div class="ttc" id="aclasshelib_1_1_col_perm_html_ad8e99bbc0c87074fb6e0573a6a4f0d7e"><div class="ttname"><a href="classhelib_1_1_col_perm.html#ad8e99bbc0c87074fb6e0573a6a4f0d7e">helib::ColPerm::getPermDim</a></div><div class="ttdeci">long getPermDim() const</div><div class="ttdef"><b>Definition:</b> permutations.h:102</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a97d8dc03b8e04481195b2201239ccf67"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a97d8dc03b8e04481195b2201239ccf67">helib::FullBinaryTree::FullBinaryTree</a></div><div class="ttdeci">FullBinaryTree(const T &amp;d, long _aux=0)</div><div class="ttdef"><b>Definition:</b> permutations.h:274</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_abde39d00c689b409268969f7e29414be"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#abde39d00c689b409268969f7e29414be">helib::GeneratorTrees::buildOptimalTrees</a></div><div class="ttdeci">long buildOptimalTrees(const NTL::Vec&lt; GenDescriptor &gt; &amp;vec, long depthBound)</div><div class="ttdef"><b>Definition:</b> OptimizePermutations.cpp:943</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_acc20c3f1ee7feaf70e5d9eeda5768c59"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#acc20c3f1ee7feaf70e5d9eeda5768c59">helib::GeneratorTrees::at</a></div><div class="ttdeci">const OneGeneratorTree &amp; at(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:481</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_abb421d196c02799e1611be09eaa71220"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#abb421d196c02799e1611be09eaa71220">helib::GeneratorTrees::getCubeSubDims</a></div><div class="ttdeci">void getCubeSubDims(NTL::Vec&lt; long &gt; &amp;dims) const</div><div class="ttdef"><b>Definition:</b> permutations.cpp:390</div></div>
<div class="ttc" id="aclasshelib_1_1_sub_dimension_html"><div class="ttname"><a href="classhelib_1_1_sub_dimension.html">helib::SubDimension</a></div><div class="ttdoc">A node in a tree relative to some generator.</div><div class="ttdef"><b>Definition:</b> permutations.h:419</div></div>
<div class="ttc" id="a_p_algebra_8h_html"><div class="ttname"><a href="_p_algebra_8h.html">PAlgebra.h</a></div><div class="ttdoc">Declarations of the classes PAlgebra.</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_a5986fc2b3d3ca6414583fb61355e4719"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#a5986fc2b3d3ca6414583fb61355e4719">helib::GeneratorTrees::mapToArray</a></div><div class="ttdeci">long mapToArray(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:492</div></div>
<div class="ttc" id="anamespacehelib_html_ae0769a209e14d5e1bfd8579072397867"><div class="ttname"><a href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">helib::Permut</a></div><div class="ttdeci">NTL::Vec&lt; long &gt; Permut</div><div class="ttdoc">A simple permutation is just a vector with p[i]=\pi_i.</div><div class="ttdef"><b>Definition:</b> permutations.h:27</div></div>
<div class="ttc" id="aclasshelib_1_1_general_benes_network_html_a52650b15e6be5b81c21c810a3317435f"><div class="ttname"><a href="classhelib_1_1_general_benes_network.html#a52650b15e6be5b81c21c810a3317435f">helib::GeneralBenesNetwork::getDepth</a></div><div class="ttdeci">long getDepth() const</div><div class="ttdef"><b>Definition:</b> permutations.h:195</div></div>
<div class="ttc" id="aclasshelib_1_1_gen_descriptor_html_a55749b52c5b5da836a1fc92f3b2ce1a3"><div class="ttname"><a href="classhelib_1_1_gen_descriptor.html#a55749b52c5b5da836a1fc92f3b2ce1a3">helib::GenDescriptor::good</a></div><div class="ttdeci">bool good</div><div class="ttdef"><b>Definition:</b> permutations.h:408</div></div>
<div class="ttc" id="aclasshelib_1_1_tree_node_html_a699a8dbe1934d152aa3804f8df118264"><div class="ttname"><a href="classhelib_1_1_tree_node.html#a699a8dbe1934d152aa3804f8df118264">helib::TreeNode::TreeNode</a></div><div class="ttdeci">TreeNode(const T &amp;d)</div><div class="ttdef"><b>Definition:</b> permutations.h:243</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_a2d5d127d11b5736b62ce5e5dd51d7927"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#a2d5d127d11b5736b62ce5e5dd51d7927">helib::GeneratorTrees::ComputeCubeMapping</a></div><div class="ttdeci">void ComputeCubeMapping()</div><div class="ttdoc">Computes permutations mapping between linear array and the cube.</div><div class="ttdef"><b>Definition:</b> permutations.cpp:456</div></div>
<div class="ttc" id="anamespacehelib_html_a0ae17bbc28a578112d0fe28b99f5e204"><div class="ttname"><a href="namespacehelib.html#a0ae17bbc28a578112d0fe28b99f5e204">helib::applyPermsToVec</a></div><div class="ttdeci">void applyPermsToVec(NTL::Vec&lt; T &gt; &amp;out, const NTL::Vec&lt; T &gt; &amp;in, const Permut &amp;p2, const Permut &amp;p1)</div><div class="ttdoc">Apply two permutations to a std::vector out[i]=in[p2[p1[i]]] (NOT in-place)</div><div class="ttdef"><b>Definition:</b> permutations.cpp:46</div></div>
<div class="ttc" id="aclasshelib_1_1_col_perm_html_a32e6af8568f7b694f7cf8ac741068876"><div class="ttname"><a href="classhelib_1_1_col_perm.html#a32e6af8568f7b694f7cf8ac741068876">helib::ColPerm::ColPerm</a></div><div class="ttdeci">ColPerm(const CubeSignature &amp;_sig)</div><div class="ttdef"><b>Definition:</b> permutations.h:97</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a01798e019b8ce5bf570b834478b73e7d"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a01798e019b8ce5bf570b834478b73e7d">helib::FullBinaryTree::rootIdx</a></div><div class="ttdeci">long rootIdx() const</div><div class="ttdef"><b>Definition:</b> permutations.h:315</div></div>
<div class="ttc" id="aclasshelib_1_1_gen_descriptor_html"><div class="ttname"><a href="classhelib_1_1_gen_descriptor.html">helib::GenDescriptor</a></div><div class="ttdoc">A minimal description of a generator for the purpose of building tree.</div><div class="ttdef"><b>Definition:</b> permutations.h:404</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_ae6360cb4b9adbf55b91ac2cdbe5515df"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#ae6360cb4b9adbf55b91ac2cdbe5515df">helib::GeneratorTrees::operator&lt;&lt;</a></div><div class="ttdeci">friend std::ostream &amp; operator&lt;&lt;(std::ostream &amp;s, const GeneratorTrees &amp;t)</div><div class="ttdef"><b>Definition:</b> permutations.cpp:518</div></div>
<div class="ttc" id="aclasshelib_1_1_tree_node_html_aba2c5e9f1bc8ec08cd5f1acd9265b94b"><div class="ttname"><a href="classhelib_1_1_tree_node.html#aba2c5e9f1bc8ec08cd5f1acd9265b94b">helib::TreeNode::getParent</a></div><div class="ttdeci">long getParent() const</div><div class="ttdef"><b>Definition:</b> permutations.h:248</div></div>
<div class="ttc" id="aclasshelib_1_1_general_benes_network_html_ae86d8873a231c2834359507781f6dfc3"><div class="ttname"><a href="classhelib_1_1_general_benes_network.html#ae86d8873a231c2834359507781f6dfc3">helib::GeneralBenesNetwork::depth</a></div><div class="ttdeci">static long depth(long n)</div><div class="ttdef"><b>Definition:</b> permutations.h:168</div></div>
<div class="ttc" id="aapi_attributes_8h_html_addf5ec070e9499d36b7f2009ce736076"><div class="ttname"><a href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a></div><div class="ttdeci">#define UNUSED</div><div class="ttdef"><b>Definition:</b> apiAttributes.h:31</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_ada5044b425b9e1a287c43af7985721ee"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#ada5044b425b9e1a287c43af7985721ee">helib::GeneratorTrees::at</a></div><div class="ttdeci">OneGeneratorTree &amp; at(long i)</div><div class="ttdef"><b>Definition:</b> permutations.h:480</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html">helib::FullBinaryTree</a></div><div class="ttdoc">A simple implementation of full binary trees (each non-leaf has 2 children)</div><div class="ttdef"><b>Definition:</b> permutations.h:225</div></div>
<div class="ttc" id="aclasshelib_1_1_col_perm_html_ab93293184a7cf1d97b6fc71c5df5e02d"><div class="ttname"><a href="classhelib_1_1_col_perm.html#ab93293184a7cf1d97b6fc71c5df5e02d">helib::ColPerm::getBenesShiftAmounts</a></div><div class="ttdeci">void getBenesShiftAmounts(NTL::Vec&lt; Permut &gt; &amp;out, NTL::Vec&lt; bool &gt; &amp;idID, const NTL::Vec&lt; long &gt; &amp;benesLvls) const</div><div class="ttdef"><b>Definition:</b> permutations.cpp:169</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_ad2a5c0e3e0c0b66aacd2629503853575"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#ad2a5c0e3e0c0b66aacd2629503853575">helib::FullBinaryTree::getNleaves</a></div><div class="ttdeci">long getNleaves() const</div><div class="ttdef"><b>Definition:</b> permutations.h:309</div></div>
<div class="ttc" id="aclasshelib_1_1_gen_descriptor_html_a58c7969353443b04c963bd021281ca56"><div class="ttname"><a href="classhelib_1_1_gen_descriptor.html#a58c7969353443b04c963bd021281ca56">helib::GenDescriptor::genIdx</a></div><div class="ttdeci">long genIdx</div><div class="ttdef"><b>Definition:</b> permutations.h:406</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_a14ea69288666f85258a6879a8cf603fd"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#a14ea69288666f85258a6879a8cf603fd">helib::GeneratorTrees::getGenTree</a></div><div class="ttdeci">const OneGeneratorTree &amp; getGenTree(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:484</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_ad0b111242279dc9fea42852485b627b4"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#ad0b111242279dc9fea42852485b627b4">helib::FullBinaryTree::printout</a></div><div class="ttdeci">void printout(std::ostream &amp;s, long idx=0) const</div><div class="ttdef"><b>Definition:</b> permutations.h:320</div></div>
<div class="ttc" id="aclasshelib_1_1_tree_node_html_a284ec567171c8b62b23dd350f4e820a4"><div class="ttname"><a href="classhelib_1_1_tree_node.html#a284ec567171c8b62b23dd350f4e820a4">helib::TreeNode::getData</a></div><div class="ttdeci">const T &amp; getData() const</div><div class="ttdef"><b>Definition:</b> permutations.h:246</div></div>
<div class="ttc" id="aclasshelib_1_1_sub_dimension_html_a324e87ee0005625c836ba3ab4218f076"><div class="ttname"><a href="classhelib_1_1_sub_dimension.html#a324e87ee0005625c836ba3ab4218f076">helib::SubDimension::e</a></div><div class="ttdeci">long e</div><div class="ttdef"><b>Definition:</b> permutations.h:424</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_afb44279bb6acdf1d915345b4138655d7"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#afb44279bb6acdf1d915345b4138655d7">helib::FullBinaryTree::operator[]</a></div><div class="ttdeci">const TreeNode&lt; T &gt; &amp; operator[](long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:298</div></div>
<div class="ttc" id="aclasshelib_1_1_tree_node_html_a4e2b6a600741294bd01d9904aa8fbf5a"><div class="ttname"><a href="classhelib_1_1_tree_node.html#a4e2b6a600741294bd01d9904aa8fbf5a">helib::TreeNode::TreeNode</a></div><div class="ttdeci">TreeNode()</div><div class="ttdef"><b>Definition:</b> permutations.h:242</div></div>
<div class="ttc" id="aclasshelib_1_1_sub_dimension_html_a531e85e2f833626a32623ec33b66c35f"><div class="ttname"><a href="classhelib_1_1_sub_dimension.html#a531e85e2f833626a32623ec33b66c35f">helib::SubDimension::SubDimension</a></div><div class="ttdeci">SubDimension(long sz=0, bool gd=false, long ee=0, const NTL::Vec&lt; long &gt; &amp;bns1=dummyBenes, const NTL::Vec&lt; long &gt; &amp;bns2=dummyBenes)</div><div class="ttdef"><b>Definition:</b> permutations.h:434</div></div>
<div class="ttc" id="anamespacehelib_html"><div class="ttname"><a href="namespacehelib.html">helib</a></div><div class="ttdef"><b>Definition:</b> apiAttributes.h:21</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_network_html_a09257bcc62d95f5c7c1fc9a31ae85c9b"><div class="ttname"><a href="classhelib_1_1_perm_network.html#a09257bcc62d95f5c7c1fc9a31ae85c9b">helib::PermNetwork::buildNetwork</a></div><div class="ttdeci">void buildNetwork(const Permut &amp;pi, const GeneratorTrees &amp;trees)</div><div class="ttdef"><b>Definition:</b> PermNetwork.cpp:77</div></div>
<div class="ttc" id="aapi_attributes_8h_html"><div class="ttname"><a href="api_attributes_8h.html">apiAttributes.h</a></div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a7a67cd22f751036ddb171304de250d56"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a7a67cd22f751036ddb171304de250d56">helib::FullBinaryTree::setAuxKey</a></div><div class="ttdeci">void setAuxKey(long _aux)</div><div class="ttdef"><b>Definition:</b> permutations.h:307</div></div>
<div class="ttc" id="aclasshelib_1_1_general_benes_network_html_ae53c9f8e60c303de64a106e84069d17c"><div class="ttname"><a href="classhelib_1_1_general_benes_network.html#ae53c9f8e60c303de64a106e84069d17c">helib::GeneralBenesNetwork::getSize</a></div><div class="ttdeci">long getSize() const</div><div class="ttdef"><b>Definition:</b> permutations.h:196</div></div>
<div class="ttc" id="aclasshelib_1_1_cube_signature_html"><div class="ttname"><a href="classhelib_1_1_cube_signature.html">helib::CubeSignature</a></div><div class="ttdoc">Holds a vector of dimensions for a hypercube and some additional data.</div><div class="ttdef"><b>Definition:</b> hypercube.h:28</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a0eff022e81edd65c23a19e745cdea1a8"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a0eff022e81edd65c23a19e745cdea1a8">helib::FullBinaryTree::putDataInRoot</a></div><div class="ttdeci">void putDataInRoot(const T &amp;d)</div><div class="ttdef"><b>Definition:</b> permutations.h:283</div></div>
<div class="ttc" id="anamespacehelib_html_a11554e25622d14682edfa2be22ed6df6"><div class="ttname"><a href="namespacehelib.html#a11554e25622d14682edfa2be22ed6df6">helib::breakPermByDim</a></div><div class="ttdeci">void breakPermByDim(std::vector&lt; ColPerm &gt; &amp;out, const Permut &amp;pi, const CubeSignature &amp;sig)</div><div class="ttdoc">Takes a permutation pi over m-dimensional cube C=Z_{n1} x...x Z_{nm} and expresses pi as a product pi...</div><div class="ttdef"><b>Definition:</b> permutations.cpp:333</div></div>
<div class="ttc" id="aclasshelib_1_1_gen_descriptor_html_a9833f48c6a7d200fab1ca856f07d67e4"><div class="ttname"><a href="classhelib_1_1_gen_descriptor.html#a9833f48c6a7d200fab1ca856f07d67e4">helib::GenDescriptor::GenDescriptor</a></div><div class="ttdeci">GenDescriptor(long _order, bool _good, long gen=0)</div><div class="ttdef"><b>Definition:</b> permutations.h:410</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_abae76f45adc4861d192e56f0c15f33a0"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#abae76f45adc4861d192e56f0c15f33a0">helib::GeneratorTrees::mapToCube</a></div><div class="ttdeci">Permut &amp; mapToCube()</div><div class="ttdef"><b>Definition:</b> permutations.h:488</div></div>
<div class="ttc" id="aclasshelib_1_1_general_benes_network_html_a9e9329ff90053d6c4fab07b0a32fa509"><div class="ttname"><a href="classhelib_1_1_general_benes_network.html#a9e9329ff90053d6c4fab07b0a32fa509">helib::GeneralBenesNetwork::getNumLevels</a></div><div class="ttdeci">long getNumLevels() const</div><div class="ttdef"><b>Definition:</b> permutations.h:197</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_a08df7eda4dc9cb44c6900c2b3bea0cda"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#a08df7eda4dc9cb44c6900c2b3bea0cda">helib::GeneratorTrees::numLayers</a></div><div class="ttdeci">long numLayers() const</div><div class="ttdef"><b>Definition:</b> permutations.h:474</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_a409877a65286742bce5dfd602c0f61fb"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#a409877a65286742bce5dfd602c0f61fb">helib::GeneratorTrees::numTrees</a></div><div class="ttdeci">long numTrees() const</div><div class="ttdef"><b>Definition:</b> permutations.h:475</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_a6a089d3a37735f4dc2263c6e50919c04"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#a6a089d3a37735f4dc2263c6e50919c04">helib::GeneratorTrees::getGenTree</a></div><div class="ttdeci">OneGeneratorTree &amp; getGenTree(long i)</div><div class="ttdef"><b>Definition:</b> permutations.h:483</div></div>
<div class="ttc" id="anamespacehelib_html_addc58993c7093dd07d98335bab200e82"><div class="ttname"><a href="namespacehelib.html#addc58993c7093dd07d98335bab200e82">helib::operator&lt;&lt;</a></div><div class="ttdeci">std::ostream &amp; operator&lt;&lt;(std::ostream &amp;s, const SKHandle &amp;handle)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:189</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_network_html"><div class="ttname"><a href="classhelib_1_1_perm_network.html">helib::PermNetwork</a></div><div class="ttdoc">A full permutation network.</div><div class="ttdef"><b>Definition:</b> permutations.h:559</div></div>
<div class="ttc" id="aclasshelib_1_1_hyper_cube_html"><div class="ttname"><a href="classhelib_1_1_hyper_cube.html">helib::HyperCube</a></div><div class="ttdoc">A multi-dimensional cube.</div><div class="ttdef"><b>Definition:</b> hypercube.h:221</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_net_layer_html_ac4bb96428da1ee9e326889547c7678c2"><div class="ttname"><a href="classhelib_1_1_perm_net_layer.html#ac4bb96428da1ee9e326889547c7678c2">helib::PermNetLayer::getGenIdx</a></div><div class="ttdeci">long getGenIdx() const</div><div class="ttdef"><b>Definition:</b> permutations.h:551</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html"><div class="ttname"><a href="classhelib_1_1_generator_trees.html">helib::GeneratorTrees</a></div><div class="ttdoc">A std::vector of generator trees, one per generator in Zm*‍/(p)</div><div class="ttdef"><b>Definition:</b> permutations.h:460</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_aa5c5e1b7c602e7b870ed63fd6df7d2a0"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#aa5c5e1b7c602e7b870ed63fd6df7d2a0">helib::GeneratorTrees::mapToCube</a></div><div class="ttdeci">long mapToCube(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:491</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a47298692347d43b21db61cad2bb9e859"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a47298692347d43b21db61cad2bb9e859">helib::FullBinaryTree::operator[]</a></div><div class="ttdeci">TreeNode&lt; T &gt; &amp; operator[](long i)</div><div class="ttdef"><b>Definition:</b> permutations.h:297</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_a926596f994e0f372a6115c8518e63961"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#a926596f994e0f372a6115c8518e63961">helib::GeneratorTrees::operator[]</a></div><div class="ttdeci">OneGeneratorTree &amp; operator[](long i)</div><div class="ttdef"><b>Definition:</b> permutations.h:478</div></div>
<div class="ttc" id="aclasshelib_1_1_general_benes_network_html_a7743131bdd9828324785b1d1ab329c2e"><div class="ttname"><a href="classhelib_1_1_general_benes_network.html#a7743131bdd9828324785b1d1ab329c2e">helib::GeneralBenesNetwork::shamt</a></div><div class="ttdeci">static long shamt(long n, long k, long i)</div><div class="ttdef"><b>Definition:</b> permutations.h:189</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_network_html_ab95327c63d9e120839d5e224b7baf418"><div class="ttname"><a href="classhelib_1_1_perm_network.html#ab95327c63d9e120839d5e224b7baf418">helib::PermNetwork::PermNetwork</a></div><div class="ttdeci">PermNetwork(const Permut &amp;pi, const GeneratorTrees &amp;trees)</div><div class="ttdef"><b>Definition:</b> permutations.h:572</div></div>
<div class="ttc" id="anamespacehelib_html_a0cf8627539f6c1c46e6ae9287058f7cc"><div class="ttname"><a href="namespacehelib.html#a0cf8627539f6c1c46e6ae9287058f7cc">helib::applyPermToVec</a></div><div class="ttdeci">void applyPermToVec(NTL::Vec&lt; T &gt; &amp;out, const NTL::Vec&lt; T &gt; &amp;in, const Permut &amp;p1)</div><div class="ttdoc">Apply a permutation to a std::vector, out[i]=in[p1[i]] (NOT in-place)</div><div class="ttdef"><b>Definition:</b> permutations.cpp:23</div></div>
<div class="ttc" id="aclasshelib_1_1_sub_dimension_html_abc770e9e4566f90224c7cfbb43c20249"><div class="ttname"><a href="classhelib_1_1_sub_dimension.html#abc770e9e4566f90224c7cfbb43c20249">helib::SubDimension::operator&lt;&lt;</a></div><div class="ttdeci">friend std::ostream &amp; operator&lt;&lt;(std::ostream &amp;s, const SubDimension &amp;tree)</div><div class="ttdef"><b>Definition:</b> permutations.cpp:509</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_net_layer_html_a89a021ac775c621b4c55b9e96bde52c1"><div class="ttname"><a href="classhelib_1_1_perm_net_layer.html#a89a021ac775c621b4c55b9e96bde52c1">helib::PermNetLayer::getShifts</a></div><div class="ttdeci">const NTL::Vec&lt; long &gt; &amp; getShifts() const</div><div class="ttdef"><b>Definition:</b> permutations.h:553</div></div>
<div class="ttc" id="anamespacehelib_html_aa74c29f86e466570325f829fe4ea74b0"><div class="ttname"><a href="namespacehelib.html#aa74c29f86e466570325f829fe4ea74b0">helib::randomPerm</a></div><div class="ttdeci">void randomPerm(Permut &amp;perm, long n)</div><div class="ttdoc">A random size-n permutation.</div><div class="ttdef"><b>Definition:</b> permutations.cpp:93</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_af1fc160bcf09404218e1601140f5ff05"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#af1fc160bcf09404218e1601140f5ff05">helib::GeneratorTrees::mapToArray</a></div><div class="ttdeci">const Permut &amp; mapToArray() const</div><div class="ttdef"><b>Definition:</b> permutations.h:487</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a1b0c2cd16833ff1cf0a8aae2546c41ae"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a1b0c2cd16833ff1cf0a8aae2546c41ae">helib::FullBinaryTree::parentIdx</a></div><div class="ttdeci">long parentIdx(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:316</div></div>
<div class="ttc" id="aclasshelib_1_1_general_benes_network_html"><div class="ttname"><a href="classhelib_1_1_general_benes_network.html">helib::GeneralBenesNetwork</a></div><div class="ttdoc">Implementation of generalized Benes Permutation Network.</div><div class="ttdef"><b>Definition:</b> permutations.h:152</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_net_layer_html_a414c92ddb59a5b1623e88f00f1e05770"><div class="ttname"><a href="classhelib_1_1_perm_net_layer.html#a414c92ddb59a5b1623e88f00f1e05770">helib::PermNetLayer::operator&lt;&lt;</a></div><div class="ttdeci">friend std::ostream &amp; operator&lt;&lt;(std::ostream &amp;s, const PermNetwork &amp;net)</div><div class="ttdef"><b>Definition:</b> PermNetwork.cpp:20</div></div>
<div class="ttc" id="aclasshelib_1_1_tree_node_html_aeba5112cf6532e25198e67054a7fdbdc"><div class="ttname"><a href="classhelib_1_1_tree_node.html#aeba5112cf6532e25198e67054a7fdbdc">helib::TreeNode::getRightChild</a></div><div class="ttdeci">long getRightChild() const</div><div class="ttdef"><b>Definition:</b> permutations.h:250</div></div>
<div class="ttc" id="aclasshelib_1_1_col_perm_html_afcb79f8c47fe29afc159d3471c270263"><div class="ttname"><a href="classhelib_1_1_col_perm.html#afcb79f8c47fe29afc159d3471c270263">helib::ColPerm::printout</a></div><div class="ttdeci">void printout(std::ostream &amp;s)</div><div class="ttdoc">A test/debugging method.</div><div class="ttdef"><b>Definition:</b> permutations.h:128</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a27f96d10780585b551451e95d33565a2"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a27f96d10780585b551451e95d33565a2">helib::FullBinaryTree::DataOfNode</a></div><div class="ttdeci">T &amp; DataOfNode(long i)</div><div class="ttdef"><b>Definition:</b> permutations.h:303</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html"><div class="ttname"><a href="classhelib_1_1_ctxt.html">helib::Ctxt</a></div><div class="ttdoc">A Ctxt object holds a single ciphertext.</div><div class="ttdef"><b>Definition:</b> Ctxt.h:270</div></div>
<div class="ttc" id="aclasshelib_1_1_tree_node_html_a60b1342707e9f8113a951c0459c32419"><div class="ttname"><a href="classhelib_1_1_tree_node.html#a60b1342707e9f8113a951c0459c32419">helib::TreeNode::getNext</a></div><div class="ttdeci">long getNext() const</div><div class="ttdef"><b>Definition:</b> permutations.h:252</div></div>
<div class="ttc" id="aclasshelib_1_1_general_benes_network_html_aaa72d3cd338814502f87796a68f95925"><div class="ttname"><a href="classhelib_1_1_general_benes_network.html#aaa72d3cd338814502f87796a68f95925">helib::GeneralBenesNetwork::levelToDepthMap</a></div><div class="ttdeci">long levelToDepthMap(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:208</div></div>
<div class="ttc" id="aclasshelib_1_1_col_perm_html_a59bc214fc506be70044fcc9b3784b578"><div class="ttname"><a href="classhelib_1_1_col_perm.html#a59bc214fc506be70044fcc9b3784b578">helib::ColPerm::setPermDim</a></div><div class="ttdeci">void setPermDim(long _dim)</div><div class="ttdef"><b>Definition:</b> permutations.h:103</div></div>
<div class="ttc" id="aclasshelib_1_1_sub_dimension_html_aea9f21674ad5965e474291bf80d05481"><div class="ttname"><a href="classhelib_1_1_sub_dimension.html#aea9f21674ad5965e474291bf80d05481">helib::SubDimension::scndBenes</a></div><div class="ttdeci">NTL::Vec&lt; long &gt; scndBenes</div><div class="ttdef"><b>Definition:</b> permutations.h:432</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a7d09c4eed35595ba4918da09c5e47670"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a7d09c4eed35595ba4918da09c5e47670">helib::FullBinaryTree::FullBinaryTree</a></div><div class="ttdeci">FullBinaryTree(long _aux=0)</div><div class="ttdef"><b>Definition:</b> permutations.h:267</div></div>
<div class="ttc" id="aclasshelib_1_1_hyper_cube_html_aec3fa326e745e6909d1e2c554bf63747"><div class="ttname"><a href="classhelib_1_1_hyper_cube.html#aec3fa326e745e6909d1e2c554bf63747">helib::HyperCube&lt; long &gt;::getData</a></div><div class="ttdeci">NTL::Vec&lt; long &gt; &amp; getData()</div><div class="ttdef"><b>Definition:</b> hypercube.h:267</div></div>
<div class="ttc" id="aclasshelib_1_1_tree_node_html_adda304eddb64acf8154c2bb3ab886b90"><div class="ttname"><a href="classhelib_1_1_tree_node.html#adda304eddb64acf8154c2bb3ab886b90">helib::TreeNode::getLeftChild</a></div><div class="ttdeci">long getLeftChild() const</div><div class="ttdef"><b>Definition:</b> permutations.h:249</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_a39250dec026d0e547d2d06411c0c3766"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#a39250dec026d0e547d2d06411c0c3766">helib::FullBinaryTree::nextLeaf</a></div><div class="ttdeci">long nextLeaf(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:311</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_aa3069b26a92fbad0ecd6d3c4619311e6"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#aa3069b26a92fbad0ecd6d3c4619311e6">helib::FullBinaryTree::addChildren</a></div><div class="ttdeci">long addChildren(long prntIdx, const T &amp;leftData, const T &amp;rightData)</div><div class="ttdef"><b>Definition:</b> permutations.h:349</div></div>
<div class="ttc" id="aclasshelib_1_1_tree_node_html_a9ca400783600593ead99700865257ca1"><div class="ttname"><a href="classhelib_1_1_tree_node.html#a9ca400783600593ead99700865257ca1">helib::TreeNode::getData</a></div><div class="ttdeci">T &amp; getData()</div><div class="ttdef"><b>Definition:</b> permutations.h:245</div></div>
<div class="ttc" id="aclasshelib_1_1_hyper_cube_html_a4a1d07c48de62dc384f9059c1dbd0625"><div class="ttname"><a href="classhelib_1_1_hyper_cube.html#a4a1d07c48de62dc384f9059c1dbd0625">helib::HyperCube&lt; long &gt;::getSig</a></div><div class="ttdeci">const CubeSignature &amp; getSig() const</div><div class="ttdoc">const ref to signature</div><div class="ttdef"><b>Definition:</b> hypercube.h:262</div></div>
<div class="ttc" id="aclasshelib_1_1_general_benes_network_html_aa3221b4f153e00ed2b3659111a698fc8"><div class="ttname"><a href="classhelib_1_1_general_benes_network.html#aa3221b4f153e00ed2b3659111a698fc8">helib::GeneralBenesNetwork::shamt</a></div><div class="ttdeci">long shamt(long i) const</div><div class="ttdef"><b>Definition:</b> permutations.h:209</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_net_layer_html_ac369482c12aa6a9301e3cc19f8607350"><div class="ttname"><a href="classhelib_1_1_perm_net_layer.html#ac369482c12aa6a9301e3cc19f8607350">helib::PermNetLayer::isIdentity</a></div><div class="ttdeci">bool isIdentity() const</div><div class="ttdef"><b>Definition:</b> permutations.h:554</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_ae547d2343a76c7aea8cc861ef571b4d4"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#ae547d2343a76c7aea8cc861ef571b4d4">helib::FullBinaryTree::at</a></div><div class="ttdeci">TreeNode&lt; T &gt; &amp; at(long i)</div><div class="ttdef"><b>Definition:</b> permutations.h:300</div></div>
<div class="ttc" id="aclasshelib_1_1_generator_trees_html_aeba4a1ecbde123ce39cf207b2b999d9c"><div class="ttname"><a href="classhelib_1_1_generator_trees.html#aeba4a1ecbde123ce39cf207b2b999d9c">helib::GeneratorTrees::getSize</a></div><div class="ttdeci">long getSize() const</div><div class="ttdef"><b>Definition:</b> permutations.h:476</div></div>
<div class="ttc" id="aclasshelib_1_1_full_binary_tree_html_aa00e0d8854a43a98607c68e79605dde6"><div class="ttname"><a href="classhelib_1_1_full_binary_tree.html#aa00e0d8854a43a98607c68e79605dde6">helib::FullBinaryTree::lastLeaf</a></div><div class="ttdeci">long lastLeaf() const</div><div class="ttdef"><b>Definition:</b> permutations.h:313</div></div>
<div class="ttc" id="aclasshelib_1_1_perm_net_layer_html"><div class="ttname"><a href="classhelib_1_1_perm_net_layer.html">helib::PermNetLayer</a></div><div class="ttdoc">The information needed to apply one layer of a permutation network.</div><div class="ttdef"><b>Definition:</b> permutations.h:541</div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
